Extends
Classes
Members
children :Array.<Node>
- Source:
- Overrides:
Type:
- Array.<Node>
(readonly) root
The root element of the document.
Methods
add(node) → {Node}
- Description:
- Add a child node. Side effect: sets the parent of the added node.
- Source:
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The node to add |
Returns:
The added node
- Type
- Node
(generator) descendantElements() → {Generator.<Element>}
- Description:
- Iterate over all of the descendants of this node which are Elements, to infinite depth, in prefix order. That is, parents are yielded before their children.
- Source:
- Overrides:
Returns:
- Type
- Generator.<Element>
(generator) descendants() → {Generator.<Node>}
- Description:
- Iterate over all of the descendants of this node, to infinite depth, in prefix order. That is, parents are yielded before their children.
- Source:
- Overrides:
Returns:
- Type
- Generator.<Node>
(generator) elements(localopt, nsopt) → {Generator.<Element>}
- Description:
- Iterate over all of the children of this Node which are Elements and match the given local name and namespace (if specified).
- Source:
- Overrides:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
local |
string |
<optional> |
The localname. If not given, match elements with any name |
ns |
string |
<optional> |
The namespace URI to match. If not given, match elements with any namespace. |
Returns:
- Type
- Generator.<Element>
first(pattern, contextopt) → {string|number|Node|null}
- Description:
- Get the first matching node for a given pattern, or null if none exist.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pattern |
string | XPath | The pattern to match | ||
context |
Node |
<optional> |
this.root
|
The context node. Uses the root element as context if none is provided. |
Returns:
The first match if one exists
- Type
- string | number | Node | null
get(pattern, contextopt) → {XPathResult}
- Description:
- Get all of the nodes that match the given XPath pattern, with the given context for XPath execution.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pattern |
string | XPath | The pattern to match | ||
context |
Node |
<optional> |
this.root
|
The context node. Uses the root element as context if none is provided. |
Returns:
The matching nodes
- Type
- XPathResult
text(newTextopt) → {string|Node}
- Description:
- Gets the text associated with all of the child nodes, concatenated together. This sometimes has surprising results, because of included whitespace.
- Source:
- Overrides:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
newText |
string |
<optional> |
New text to insert. Invalid on ParentNode but used for subclasses. |
Returns:
The concatenated text
- Type
- string | Node
toString(optionsopt) → {string}
- Description:
- Convert to string.
- Source:
- Overrides:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
MaybeStylizedSeparated |
<optional> |
How to convert to string |
Returns:
The node, converted to a string
- Type
- string