From 04449b4dcacaa0d936989b572b6b43ed37e2d1bb Mon Sep 17 00:00:00 2001 From: SCWR Date: Tue, 29 Jun 2021 14:49:30 +0800 Subject: Update index.html translation --- .../web/xpath/introduction_to_using_xpath_in_javascript/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/zh-cn/web/xpath/introduction_to_using_xpath_in_javascript/index.html b/files/zh-cn/web/xpath/introduction_to_using_xpath_in_javascript/index.html index d72b2fdfe7..8821b1dcb4 100644 --- a/files/zh-cn/web/xpath/introduction_to_using_xpath_in_javascript/index.html +++ b/files/zh-cn/web/xpath/introduction_to_using_xpath_in_javascript/index.html @@ -66,7 +66,7 @@ original_slug: Web/JavaScript/Introduction_to_using_XPath_in_JavaScript
var nsResolver = document.createNSResolver( contextNode.ownerDocument == null ? contextNode.documentElement : contextNode.ownerDocument.documentElement );
 
-

Or alternatively by using the <code>createNSResolver</code> method of a <code>XPathEvaluator</code> object. <pre> var xpEvaluator = new XPathEvaluator(); var nsResolver = xpEvaluator.createNSResolver( contextNode.ownerDocument == null ? contextNode.documentElement : contextNode.ownerDocument.documentElement ); </pre>

+

或者,也可以使用 XPathEvaluator 对象的 createNSResolver 方法。

 var xpEvaluator = new XPathEvaluator(); var nsResolver = xpEvaluator.createNSResolver( contextNode.ownerDocument == null ? contextNode.documentElement : contextNode.ownerDocument.documentElement ); 

然后传递 document.evaluate,将 nsResolver 变量作为 namespaceResolver 参数。

-- cgit v1.2.3-54-g00ecf