From 980fe00a74a9ad013b945755415ace2e5429c3c2 Mon Sep 17 00:00:00 2001 From: Alexey Pyltsyn Date: Wed, 27 Oct 2021 02:31:24 +0300 Subject: [RU] Remove notranslate (#2874) --- files/ru/web/api/document/evaluate/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'files/ru/web/api/document/evaluate/index.html') diff --git a/files/ru/web/api/document/evaluate/index.html b/files/ru/web/api/document/evaluate/index.html index d2839a3bc1..ec48166876 100644 --- a/files/ru/web/api/document/evaluate/index.html +++ b/files/ru/web/api/document/evaluate/index.html @@ -9,7 +9,7 @@ translation_of: Web/API/Document/evaluate

Синтаксис

-
var xpathResult = document.evaluate(
+
var xpathResult = document.evaluate(
  xpathExpression,
  contextNode,
  namespaceResolver,
@@ -27,7 +27,7 @@ translation_of: Web/API/Document/evaluate
 
 

Пример

-
var headings = document.evaluate("/html/body//h2", document, null, XPathResult.ANY_TYPE, null);
+
var headings = document.evaluate("/html/body//h2", document, null, XPathResult.ANY_TYPE, null);
 /* Найти в документе все элементы h2
  * В качестве результата будет получен узловой итератор. */
 var thisHeading = headings.iterateNext();
@@ -43,7 +43,7 @@ alert(alertText); // Показывает alert со всеми найденны
 
 

Further optimization can be achieved by careful use of the context parameter. For example, if you know the content you are looking for is somewhere inside the body tag, you can use this:

-
document.evaluate(".//h2", document.body, null, XPathResult.ANY_TYPE, null);
+
document.evaluate(".//h2", document.body, null, XPathResult.ANY_TYPE, null);
 

Notice in the above document.body has been used as the context instead of document so the XPath starts from the body element. (In this example, the "." is important to indicate that the querying should start from the context node, document.body. If the "." was left out (leaving //h2) the query would start from the root node (html) which would be more wasteful.)

-- cgit v1.2.3-54-g00ecf