XPathResult
interface represents the results generated by evaluating an XPath expression within the context of a given node. Since XPath expressions can result in a variety of result types, this interface makes it possible to determine and handle the type and value of the result.A boolean
representing the value of the result if resultType
is BOOLEAN_TYPE
.
Promise<boolean>
Signifies that the iterator has become invalid. It is true
if resultType
is UNORDERED_NODE_ITERATOR_TYPE
or ORDERED_NODE_ITERATOR_TYPE
and the document has been modified since this result was returned.
Promise<boolean>
A number
representing the value of the result if resultType
is NUMBER_TYPE
.
Promise<number>
A number
code representing the type of the result, as defined by the type constants.
Promise<number>
A Node
representing the value of the single node result, which may be null
.
NOTE: The returned SuperNode will behave like all AwaitedDom SuperNodes: nothing will be retrieved until you await the node or child property.
await result.singleNodeResult === null; // null if not present
await result.singleNodeResult.textContent; // gets text
SuperNode
The number of nodes in the result snapshot.
Promise<number>
A string
representing the value of the result if resultType
is STRING_TYPE
.
Promise<string>
If the result is a node set, this method iterates over it and returns the next node from it or null
if there are no more nodes.
NOTE: The iterated SuperNodes will behave like all AwaitedDom SuperNodes: nothing will be retrieved until you await the node or child property.
await result.iterateNext() === null; // null if not present
await result.iterateNext().textContent; // gets text
SuperNode
Returns an item of the snapshot collection or null
in case the index is not within the range of nodes. Unlike the iterator result, the snapshot does not become invalid, but may not correspond to the current document if it is mutated.
number
. Needs content.SuperNode