snapshotLength property (XPathResult)
Returns the length of the snapshots collection.
The XPathResult object represents the result of the evaluate method.
The type of the result depends on the fourth parameter of the evaluate method, or, if its value is ANY_TYPE, on the expression specified by the first parameter. With the resultType property, the type of the result can be retrieved. If the value of the resultType property is UNORDERED_NODE_SNAPSHOT_TYPE or ORDERED_NODE_SNAPSHOT_TYPE, then the result contains snapshots for all nodes that match the expression.In that case, the snapshotLength property can be used to retrieve the number of matching nodes in the snapshots collection. Use the snapshotItem method to get the matching nodes from the snapshots collection by position.
You can find the related objects in the Supported by objects section below.
This property is read-only.
Integer that retrieves the length of the snapshots collection.
Default: this property has no default value.
Example HTML code 1:
This example shows how to get all span elements that are immediate children of a given element:
Did you find this example helpful?
User Contributed Comments