Skip to content

Commit 289202d

Browse files
Remove Sibling Node Mixing
Issue: #197
1 parent 61a07ad commit 289202d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/common/xml-traverser.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,19 @@ export class XmlTraverser {
6464
}
6565

6666
getSiblings(node: Node): Node[] {
67-
return [...this.getChildAttributeArray(<Element>node.parentNode), ...this.getChildElementArray(node.parentNode)];
67+
if (this.isElement(node)) {
68+
return this.getSiblingElements(node);
69+
}
70+
71+
return this.getSiblingAttributes(node);
72+
}
73+
74+
getSiblingAttributes(node: Node): Node[] {
75+
return this.getChildAttributeArray(<Element>node.parentNode);
76+
}
77+
78+
getSiblingElements(node: Node): Node[] {
79+
return this.getChildElementArray(node.parentNode);
6880
}
6981

7082
hasSimilarSiblings(node: Node): boolean {

0 commit comments

Comments
 (0)