Name

XPathResult.snapshotItem( ): return a node that matches an XPath query

Synopsis

Node snapshotItem(index)

Arguments

index

The index of the node to be returned.

Returns

The node at the specified index, or null if the index is less than zero or greater than or equal to snapshotLength.

Throws

This method throws an exception if resultType is not UNORDERED_NODE_SNAPSHOT_TYPE or ORDERED_NODE_SNAPSHOT_TYPE.

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.