只读
booleanValue
特性为
XPathResult
interface returns the boolean value of a result with
XPathResult.resultType
being
BOOLEAN_TYPE
.
var value = result.booleanValue;
The return value is the boolean value of the
XPathResult
返回通过
Document.evaluate()
.
若
XPathResult.resultType
不是
BOOLEAN_TYPE
,
XPathException
类型
TYPE_ERR
is thrown.
The following example shows the use of the
booleanValue
特性。
<div>XPath example</div> <p>Text is 'XPath example': <output></output></p>
var xpath = "//div/text() = 'XPath example'";
var result = document.evaluate(xpath, document, null, XPathResult.BOOLEAN_TYPE, null);
document.querySelector("output").textContent = result.booleanValue;
| 规范 | 状态 | 注释 |
|---|---|---|
|
DOM (文档对象模型) 3 级 XPath 规范
The definition of 'XPathResult.booleanValue' in that specification. |
推荐 | 初始定义 |
No compatibility data found. Please contribute data for "api.XPathResult.booleanValue" (depth: 1) to the MDN 兼容性数据存储库 .