Fuzi icon indicating copy to clipboard operation
Fuzi copied to clipboard

firstChild does not properly work with tag name `text`

Open Igor-Palaguta opened this issue 2 years ago • 1 comments

Description:

  • Expected behaviour: element.firstChild(tag: "text") return first text node instead of element node with tag name "text"

  • Actual behaviour: returns element not text node

Environment

  • Package Manager: CocoaPods, version: 1.11.2

  • Fuzi version: 3.1.3

  • Xcode version: 13.4

How to reproduce:

<parent>
   <text>Some text</text>
</parent>

parent.firstChild(tag: "text")?.stringValue == " \n" instead of parent.firstChild(tag: "text")?.stringValue == "Some text" parent.firstChild(tag: "text")?.type == .Text instead of parent.firstChild(tag: "text")?.type == .Element

parent.children(tag: "text") finds proper nodes as it checks also element type

Igor-Palaguta avatar Jul 19 '22 10:07 Igor-Palaguta

@cezheng please have a look at https://github.com/cezheng/Fuzi/pull/121

Igor-Palaguta avatar Aug 04 '22 09:08 Igor-Palaguta