-
Notifications
You must be signed in to change notification settings - Fork 43
getElementsByTagName and similar methods only return immediate descendants #265
Copy link
Copy link
Closed
Labels
indevThe issue is fixed/implemented in the dev branchThe issue is fixed/implemented in the dev branch
Description
In the commonDomMain implementation of Element, the getElementsByTagName method (and similar methods) simply iterate through the direct child nodes of the element.
This differs from the expected behaviour from DOM, which is that all of the descendants of the element are searched through.
A test such as:
@Test
test_getElementsByTagName_withGrandchildNode() {
val xmlString = """
<parent>
<child>
<grandchild />
</child>
</parent>
"""
val parsed = XML().decodeFromString(Element.deserializer(), xmlString)
val grandchildren = parsed.getElementsByTagName("grandchild")
assertEquals(grandchildren.length, 1)
}will succeed on the JVM, but fail on e.g iOS
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
indevThe issue is fixed/implemented in the dev branchThe issue is fixed/implemented in the dev branch