diff options
Diffstat (limited to 'files/zh-cn/web/xpath')
-rw-r--r-- | files/zh-cn/web/xpath/introduction_to_using_xpath_in_javascript/index.html | 2 |
1 files changed, 1 insertions, 1 deletions
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 <pre class="brush: js">var nsResolver = document.createNSResolver( contextNode.ownerDocument == null ? contextNode.documentElement : contextNode.ownerDocument.documentElement ); </pre> -<p><span class="comment">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></span></p> +<p><span class="comment">或者,也可以使用 <code>XPathEvaluator</code> 对象的 <code>createNSResolver</code> 方法。<pre> var xpEvaluator = new XPathEvaluator(); var nsResolver = xpEvaluator.createNSResolver( contextNode.ownerDocument == null ? contextNode.documentElement : contextNode.ownerDocument.documentElement ); </pre></span></p> <p>然后传递 <code>document.evaluate</code>,将 <code>nsResolver</code> 变量作为 <code>namespaceResolver</code> 参数。</p> |