* Find the first child element matching the given localName (namespace-agnostic). * Returns an empty SafeXmlNode if not found, so chaining never crashes.
(localName: string)
| 33 | * Returns an empty SafeXmlNode if not found, so chaining never crashes. |
| 34 | */ |
| 35 | child(localName: string): SafeXmlNode { |
| 36 | if (!this.el) return new SafeXmlNode(null) |
| 37 | const children = this.el.children |
| 38 | for (let i = 0; i < children.length; i++) { |
| 39 | if (children[i].localName === localName) { |
| 40 | return new SafeXmlNode(children[i]) |
| 41 | } |
| 42 | } |
| 43 | return new SafeXmlNode(null) |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Get child elements, optionally filtered by localName (namespace-agnostic). |
no outgoing calls
no test coverage detected