class XPathResult
undefined
.index
th item in the snapshot collection.This is equal to FIRST_ORDERED_NODE_TYPE
since the result is always document-ordered.
This is equal to ORDERED_NODE_ITERATOR_TYPE
since the result is always document-ordered.
This is equal to ORDERED_NODE_SNAPSHOT_TYPE
since the result is always document-ordered.
undefined
.
This is a non-standard property which is set to the raw unconverted result from our
expression evaluator. It’s of the type number
, string
,
boolean
or an Array
with nodes depending on expression.
If you prefer to work with arrays instead of XPathResult.snapshotItem
You can check for this property and use it directly.
function selectNodes (expr) { // Cross-browser safe way of selecting nodes and return an Array var r = document.evaluate('//LI', document, null, 7, null); if (typeof r.value != 'undefined') return r.value; var a = []; for (var i = r.snapshotLength; --i >= 0; a[i] = r.snapshotItem(i)); return a; }
object iterateNext()
Node
, or undefined
if there are no more nodes.
object snapshotItem(number i)
index
th item in the snapshot collection.
i
- index of resuling node to return.Node
, at provided index or undefined
if invalid.
See
http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult
.