只读
invalidIteratorState
特性为
XPathResult
interface signifies that the iterator has become invalid. It is
true
if
XPathResult.resultType
is
UNORDERED_NODE_ITERATOR_TYPE
or
ORDERED_NODE_ITERATOR_TYPE
and the document has been modified since this result was returned.
var iteratorState = result.invalidIteratorState;
A boolean value indicating whether the iterator has become invalid.
The following example shows the use of the
invalidIteratorState
特性。
<div>XPath example</div> <p>Iterator state: <output></output></p>
var xpath = "//div";
var result = document.evaluate(xpath, document, null, XPathResult.ANY_TYPE, null);
// Invalidates the iterator state
document.querySelector("div").remove();
document.querySelector("output").textContent = result.invalidIteratorState ? "invalid" : "valid";
| 规范 | 状态 | 注释 |
|---|---|---|
|
DOM (文档对象模型) 3 级 XPath 规范
The definition of 'XPathResult.invalidIteratorState' in that specification. |
推荐 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
invalidIteratorState
|
Chrome Yes | Edge 12 | Firefox Yes | IE ? | Opera Yes | Safari ? | WebView Android Yes | Chrome Android Yes | Firefox Android Yes | Opera Android Yes | Safari iOS ? | Samsung Internet Android Yes |
完整支持
兼容性未知
XPathResult
booleanValue
invalidIteratorState
numberValue
resultType
singleNodeValue
snapshotLength
stringValue