aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web
diff options
context:
space:
mode:
authorMDN <actions@users.noreply.github.com>2021-05-18 00:44:37 +0000
committerMDN <actions@users.noreply.github.com>2021-05-18 00:44:37 +0000
commit40edc745dfb5c152e12080748f9357b376e8dbe9 (patch)
tree00507f03ddb986f86fab1b6280661d4010a05b03 /files/zh-cn/web
parentffc1c18ba7f546ef8103ad587592a2cfaf88e609 (diff)
downloadtranslated-content-40edc745dfb5c152e12080748f9357b376e8dbe9.tar.gz
translated-content-40edc745dfb5c152e12080748f9357b376e8dbe9.tar.bz2
translated-content-40edc745dfb5c152e12080748f9357b376e8dbe9.zip
[CRON] sync translated content
Diffstat (limited to 'files/zh-cn/web')
-rw-r--r--files/zh-cn/web/api/parentnode/index.html81
-rw-r--r--files/zh-cn/web/api/parentnode/queryselector/index.html95
-rw-r--r--files/zh-cn/web/api/parentnode/queryselectorall/index.html157
3 files changed, 0 insertions, 333 deletions
diff --git a/files/zh-cn/web/api/parentnode/index.html b/files/zh-cn/web/api/parentnode/index.html
deleted file mode 100644
index 8248512594..0000000000
--- a/files/zh-cn/web/api/parentnode/index.html
+++ /dev/null
@@ -1,81 +0,0 @@
----
-title: ParentNode
-slug: Web/API/ParentNode
-tags:
- - API
- - DOM
- - Mixin
- - Node
- - 参考
- - 接口
- - 节点
-translation_of: Web/API/ParentNode
----
-<div>{{APIRef("DOM")}}</div>
-
-<p><code><strong>ParentNode</strong></code> 混合了所有(拥有子元素的) {{domxref("Node")}} 对象包含的共有方法和属性。</p>
-
-<p><code>ParentNode</code> 是一个原始接口,不能够创建这种类型的对象;它在 {{domxref("Element")}}、{{domxref("Document")}} 和 {{domxref("DocumentFragment")}} 对象上被实现。</p>
-
-<h2 id="属性">属性</h2>
-
-<dl>
- <dt>{{domxref("ParentNode.childElementCount")}} {{readonlyInline}}</dt>
- <dd>返回一个当前 <code>ParentNode</code> 所含有的后代数量。</dd>
- <dt>{{domxref("ParentNode.children")}} {{readonlyInline}}</dt>
- <dd>返回一个包含 <code>ParentNode</code> 所有后代 {{domxref("Element")}} 对象的动态 {{domxref("HTMLCollection")}} 对象,忽略所有非元素子节点。</dd>
- <dt>{{domxref("ParentNode.firstElementChild")}} {{readonlyInline}}</dt>
- <dd>返回父节点的第一个 {{domxref("Element")}} 后代,没有时返回 <code>null</code>。</dd>
- <dt>{{domxref("ParentNode.lastElementChild")}} {{readonlyInline}}</dt>
- <dd>返回父节点的最后一个 {{domxref("Element")}} 后代,没有时返回 <code>null</code>。</dd>
-</dl>
-
-<h2 id="方法">方法</h2>
-
-<dl>
- <dt>{{domxref("ParentNode.append()")}} {{experimental_inline}}</dt>
- <dd>在父节点 <code>ParentNode</code> 的最后一个后代后面插入一组 {{domxref("Node")}} 对象或 {{domxref("DOMString")}} 对象。{{domxref("DOMString")}} 对象会以同等的 {{domxref("Text")}} 节点插入。</dd>
- <dt>{{domxref("ParentNode.prepend()")}} {{experimental_inline}}</dt>
- <dd>在父节点 <code>ParentNode</code> 第一个后代前插入一组 {{domxref("Node")}} 对象或者 {{domxref("DOMString")}} 对象。{{domxref("DOMString")}} 对象会以同等的 {{domxref("Text")}} 节点插入。</dd>
- <dt>{{domxref("ParentNode.querySelector()")}}</dt>
- <dd>返回以当前元素为根元素,匹配给定选择器的第一个元素 {{domxref("Element")}}。</dd>
- <dt>{{domxref("ParentNode.querySelectorAll()")}}</dt>
- <dd>返回一个 {{domxref("NodeList")}},表示以当前元素为根元素的匹配给定选择器组的元素列表。</dd>
-</dl>
-
-<h2 id="规范">规范</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">规范</th>
- <th scope="col">状态</th>
- <th scope="col">备注</th>
- </tr>
- <tr>
- <td>{{SpecName('DOM WHATWG', '#parentnode', 'ParentNode')}}</td>
- <td>{{Spec2('DOM WHATWG')}}</td>
- <td>Split the <code>ElementTraversal</code> interface into {{domxref("ChildNode")}} and {{domxref("ParentNode")}}. The {{domxref("ParentNode.firstElementChild")}}, {{domxref("ParentNode.lastElementChild")}}, and {{domxref("ParentNode.childElementCount")}} properties are now defined on the latter. Added the {{domxref("ParentNode.children")}} property, and the {{domxref("ParentNode.querySelector()")}}, {{domxref("ParentNode.querySelectorAll()")}}, {{domxref("ParentNode.append()")}}, and {{domxref("ParentNode.prepend()")}} methods.</td>
- </tr>
- <tr>
- <td>{{SpecName('Element Traversal', '#interface-elementTraversal', 'ElementTraversal')}}</td>
- <td>{{Spec2('Element Traversal')}}</td>
- <td>Added the initial definition of its properties to the <code>ElementTraversal</code> pure interface and used it on {{domxref("Element")}}.</td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="浏览器兼容性">浏览器兼容性</h2>
-
-
-
-<p>{{Compat("api.ParentNode")}}</p>
-
-<h2 id="参见">参见</h2>
-
-<ul>
- <li>{{domxref("ChildNode")}} 纯接口。</li>
- <li>
- <div class="syntaxbox">实现此 mixin 的对象类型:{{domxref("Document")}}、{{domxref("Element")}},和 {{domxref("DocumentFragment")}}。</div>
- </li>
-</ul>
diff --git a/files/zh-cn/web/api/parentnode/queryselector/index.html b/files/zh-cn/web/api/parentnode/queryselector/index.html
deleted file mode 100644
index e5e994c845..0000000000
--- a/files/zh-cn/web/api/parentnode/queryselector/index.html
+++ /dev/null
@@ -1,95 +0,0 @@
----
-title: ParentNode.querySelector()
-slug: Web/API/ParentNode/querySelector
-translation_of: Web/API/ParentNode/querySelector
----
-<p>{{APIRef("DOM")}}{{Draft}}</p>
-
-<p>{{DOMxRef("ParentNode")}} mixin 将 <code><strong>querySelector()</strong></code> 方法定义为返回一个 {{DOMxRef("Element")}} 表示与指定的选择器组匹配的第一个元素,这些选择器是调用该方法的对象的后代。</p>
-
-<p>如果您需要与选择器列表匹配的所有元素,使用 {{DOMxRef("ParentNode.querySelectorAll", "querySelectorAll()")}} 。</p>
-
-<div class="blockIndicator note">
-<p><strong>Note:</strong> 该方法的实现为 {{DOMxRef("Document.querySelector()")}}, {{DOMxRef("DocumentFragment.querySelector()")}} 和 {{DOMxRef("Element.querySelector()")}}.</p>
-</div>
-
-<h2 id="语法">语法</h2>
-
-<pre class="syntaxbox"><var>element</var> = <em>parentNode</em>.querySelector(<var>selectors</var>);
-</pre>
-
-<h3 id="参数">参数</h3>
-
-<dl>
- <dt><code>selectors</code></dt>
- <dd>{{DOMxRef("DOMString")}} 包含一个或多个要匹配的选择器。该字符串必须是浏览器支持的<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors">compound selector list</a> ;如果不是, 会抛出 <code>SyntaxError</code> 异常. 查阅 <a href="/en-US/docs/Web/API/Document_object_model/Locating_DOM_elements_using_selectors">Locating DOM elements using selectors</a> 获取有关选择器使用的更多信息. 可以通过使用逗号分隔多个选择器来指定它们。</dd>
-</dl>
-
-<div class="blockIndicator note">
-<p><strong>Note:</strong> 必须使用反斜杠字符转义不属于CSS语法的字符。由于JavaScript也使用退格转义,因此在使用这些字符编写字符串文字是必须特别小心。查阅 {{anch("Escaping special characters")}} 获取更多信息。</p>
-</div>
-
-<h3 id="返回值">返回值</h3>
-
-<p>第一个 {{DOMxRef("Element")}} 匹配至少一个指定的选择器,如果没有找到这样的元素,返回 <code>null</code> 。</p>
-
-<div class="blockIndicator note">
-<p><strong>Note:</strong> 如果指定的选择器包含 <a href="/en-US/docs/Web/CSS/Pseudo-elements">CSS pseudo-element</a>, 则返回值始终为 <code>null</code>.</p>
-</div>
-
-<h3 id="Exceptions">Exceptions</h3>
-
-<dl>
- <dt><code>SyntaxError</code></dt>
- <dd>指定的 <code>selectors</code> 字符串语法无效。</dd>
-</dl>
-
-<h2 id="Specifications">Specifications</h2>
-
-<table class="standard-table">
- <thead>
- <tr>
- <th scope="col">Specification</th>
- <th scope="col">Status</th>
- <th scope="col">Comment</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>{{SpecName("DOM WHATWG", "#dom-parentnode-queryselector", "ParentNode.querySelector()")}}</td>
- <td>{{Spec2("DOM WHATWG")}}</td>
- <td>Living standard</td>
- </tr>
- <tr>
- <td>{{SpecName("Selectors API Level 2", "#dom-parentnode-queryselector", "ParentNode.querySelector()")}}</td>
- <td>{{Spec2("Selectors API Level 2")}}</td>
- <td>No change</td>
- </tr>
- <tr>
- <td>{{SpecName("DOM4", "#dom-parentnode-queryselector", "ParentNode.querySelector()")}}</td>
- <td>{{Spec2("DOM4")}}</td>
- <td>Initial definition</td>
- </tr>
- <tr>
- <td>{{SpecName("Selectors API Level 1", "#interface-definitions", "document.querySelector()")}}</td>
- <td>{{Spec2("Selectors API Level 1")}}</td>
- <td>Original definition</td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Browser_compatibility">Browser compatibility</h2>
-
-
-
-<p>{{Compat("api.ParentNode.querySelector")}}</p>
-
-<h2 id="See_also">See also</h2>
-
-<ul>
- <li><a href="/en-US/docs/Web/API/Document_object_model/Locating_DOM_elements_using_selectors">Locating DOM elements using selectors</a></li>
- <li><a href="/en-US/docs/Code_snippets/QuerySelector">Code snippets for <code>querySelector()</code></a></li>
- <li><a href="/en-US/docs/Web/CSS/Attribute_selectors">Attribute selectors</a> in the CSS Guide</li>
- <li><a href="/en-US/docs/Learn/CSS/Introduction_to_CSS/Attribute_selectors">Attribute selectors</a> in the MDN Learning Area</li>
- <li>This method is available as {{DOMxRef("Element.querySelector()")}}, {{DOMxRef("Document.querySelector()")}}, and {{DOMxRef("DocumentFragment.querySelector()")}}</li>
-</ul>
diff --git a/files/zh-cn/web/api/parentnode/queryselectorall/index.html b/files/zh-cn/web/api/parentnode/queryselectorall/index.html
deleted file mode 100644
index 2f7bc72f71..0000000000
--- a/files/zh-cn/web/api/parentnode/queryselectorall/index.html
+++ /dev/null
@@ -1,157 +0,0 @@
----
-title: ParentNode.querySelectorAll()
-slug: Web/API/ParentNode/querySelectorAll
-tags:
- - API
- - DOM
- - Document
- - ParentNode
- - 参考
- - 方法
- - 查找
- - 选择器
-translation_of: Web/API/ParentNode/querySelectorAll
----
-<div>{{ApiRef("DOM")}}</div>
-
-<p>The {{domxref("ParentNode")}} mixin defines the <code><strong>querySelectorAll()</strong></code> method 返回一个 {{domxref("NodeList")}} 表示元素的列表,把当前的元素作为根与指定的选择器组相匹配。</p>
-
-<p>如果你只需要一个结果,可以考虑使用{{domxref("ParentNode.querySelector", "querySelector()")}}方法来代替。</p>
-
-<div class="note">
-<p><strong>Note:</strong> This method is implemented as {{domxref("Element.querySelectorAll()")}}, {{domxref("Document.querySelectorAll()")}}, and {{domxref("DocumentFragment.querySelectorAll()")}}</p>
-</div>
-
-<h2 id="语法">语法</h2>
-
-<pre class="syntaxbox notranslate"><var>elementList</var> = <em>parentNode</em>.querySelectorAll(<var>selectors</var>);
-</pre>
-
-<h3 id="参数">参数</h3>
-
-<dl>
- <dt><code>selectors</code></dt>
- <dd>一个或多个<a href="/en-US/docs/Web/CSS/CSS_Selectors">CSS选择器</a>,这些选择器由逗号隔开。</dd>
- <dd>A {{domxref("DOMString")}} containing one or more selectors to match against. This string must be a valid <a href="/en-US/docs/Web/CSS/CSS_Selectors">CSS selector</a> string; if it's not, a <code>SyntaxError</code> exception is thrown. See <a href="/en-US/docs/Web/API/Document_object_model/Locating_DOM_elements_using_selectors">Locating DOM elements using selectors</a> for more information about using selectors to identify elements. Multiple selectors may be specified by separating them using commas.</dd>
-</dl>
-
-<div class="note">
-<p><strong>Note:</strong> Characters which are not part of standard CSS syntax must be escaped using a backslash character. Since JavaScript also uses backslash escaping, special care must be taken when writing string literals using these characters. See {{anch("Escaping special characters")}} for more information.</p>
-</div>
-
-<h3 id="返回值">返回值</h3>
-
-<p>一个不存活的 {{domxref("NodeList")}} ,每个子节点拥有一个 {{domxref("Element")}} 对象,其中每个子节点至少与一个选择器相匹配。</p>
-
-<div class="note">
-<p><strong>Note:</strong> 如果指定的 <code>selectors</code> 包含<a href="/en-US/docs/Web/CSS/Pseudo-elements">CSS pseudo-element</a>,那么返回的列表始终为空。</p>
-</div>
-
-<h3 id="Exceptions">Exceptions</h3>
-
-<dl>
- <dt><code>SyntaxError</code></dt>
- <dd>The syntax of the specified <code>selectors</code> string is not valid.</dd>
-</dl>
-
-<h2 id="例子">例子</h2>
-
-<p>To obtain a {{domxref("NodeList")}} of all of the {{HTMLElement("p")}} elements in the document:</p>
-
-<pre class="brush: js notranslate">var matches = document.querySelectorAll("p");</pre>
-
-<p>这个例子返回了所有 class 为 "note" 或者 "alert" 的 div 元素的一个列表:</p>
-
-<pre class="brush: js notranslate">var matches = document.querySelectorAll("div.note, div.alert");</pre>
-
-<p>Here, we get a list of <code>&lt;p&gt;</code> elements whose immediate parent element is a {{domxref("div")}} with the class <code>"highlighted"</code> and which are located inside a container whose ID is <code>"test"</code>.</p>
-
-<pre class="brush: js notranslate">var container = document.querySelector("#test");
-var matches = container.querySelectorAll("div.highlighted &gt; p");</pre>
-
-<p>This example uses an <a href="/en-US/docs/Web/CSS/Attribute_selectors">attribute selector</a> to return a list of the {{domxref("iframe")}} elements in the document that contain an attribute named <code>"data-src"</code>:</p>
-
-<pre class="brush: js notranslate">var matches = document.querySelectorAll("iframe[data-src]");</pre>
-
-<p>Here, an attribute selector is used to return a list of the list items contained within a list whose ID is <code>"userlist"</code> which have a <code>"data-active"</code> attribute whose value is <code>"1"</code>:</p>
-
-<pre class="brush: js notranslate">var container = document.querySelector("#userlist");
-var matches = container.querySelectorAll("li[data-active=1]");</pre>
-
-<h2 id="User_notes">User notes</h2>
-
-<p><code>querySelectorAll()</code> behaves differently than most common JavaScript DOM libraries, which might lead to unexpected results.</p>
-
-<h3 id="HTML">HTML</h3>
-
-<p>Consider this HTML, with its three nested {{HTMLElement("div")}} blocks.</p>
-
-<pre class="brush: html notranslate">&lt;div class="outer"&gt;
- &lt;div class="select"&gt;
- &lt;div class="inner"&gt;
- &lt;/div&gt;
- &lt;/div&gt;
-&lt;/div&gt;</pre>
-
-<h3 id="JavaScript">JavaScript</h3>
-
-<pre class="brush: js notranslate">var select = document.querySelector('.select');
-var inner = select.querySelectorAll('.outer .inner');
-inner.length; // 1, not 0!
-</pre>
-
-<p>In this example, when selecting <code>".outer .inner"</code> in the context the <code>&lt;div&gt;</code> with the class <code>"select"</code>, the element with the class <code>".inner"</code> is still found, even though <code>.outer</code> is not a descendant of the base element on which the search is performed (<code>".select"</code>). By default, <code>querySelectorAll()</code> only verifies that the last element in the selector is within the search scope.</p>
-
-<p>The {{cssxref(":scope")}} pseudo-class restores the expected behavior, only matching selectors on descendants of the base element:</p>
-
-<pre class="brush: js notranslate">var select = document.querySelector('.select');
-var inner = select.querySelectorAll(':scope .outer .inner');
-inner.length; // 0</pre>
-
-<h2 id="规范">规范</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">Specification</th>
- <th scope="col">Status</th>
- <th scope="col">Comment</th>
- </tr>
- <tr>
- <td>{{SpecName("DOM WHATWG", "#dom-parentnode-queryselectorall", "ParentNode.querySelectorAll()")}}</td>
- <td>{{Spec2("DOM WHATWG")}}</td>
- <td>Living standard</td>
- </tr>
- <tr>
- <td>{{SpecName("Selectors API Level 2", "#dom-parentnode-queryselectorall", "ParentNode.querySelectorAll()")}}</td>
- <td>{{Spec2("Selectors API Level 2")}}</td>
- <td>No change</td>
- </tr>
- <tr>
- <td>{{SpecName("DOM4", "#dom-parentnode-queryselectorall", "ParentNode.querySelectorAll()")}}</td>
- <td>{{Spec2("DOM4")}}</td>
- <td>Initial definition</td>
- </tr>
- <tr>
- <td>{{SpecName("Selectors API Level 1", "#interface-definitions", "document.querySelector()")}}</td>
- <td>{{Spec2("Selectors API Level 1")}}</td>
- <td>Original definition</td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="浏览器兼容性">浏览器兼容性</h2>
-
-
-
-<p>{{Compat("api.ParentNode.querySelectorAll")}}</p>
-
-<h2 id="参见">参见</h2>
-
-<ul>
- <li><a href="/en-US/docs/Web/API/Document_object_model/Locating_DOM_elements_using_selectors">Locating DOM elements using selectors</a></li>
- <li><a href="/en-US/docs/Code_snippets/QuerySelector">Code snippets for <code>querySelector()</code></a></li>
- <li><a href="/en-US/docs/Web/CSS/Attribute_selectors">Attribute selectors</a> in the CSS Guide</li>
- <li><a href="/en-US/docs/Learn/CSS/Introduction_to_CSS/Attribute_selectors">Attribute selectors</a> in the MDN Learning Area</li>
- <li>This method is available as {{domxref("Element.querySelectorAll()")}}, {{domxref("Document.querySelectorAll()")}}, and {{domxref("DocumentFragment.querySelectorAll()")}}</li>
-</ul>