From 9daad59fa2578dcc9603833b0a9a22b93d362b5e Mon Sep 17 00:00:00 2001 From: MDN Date: Fri, 16 Apr 2021 00:10:51 +0000 Subject: [CRON] sync translated content --- files/zh-cn/_redirects.txt | 10 ++- files/zh-cn/_wikihistory.json | 46 +++++------ .../api/parentnode/firstelementchild/index.html | 96 ++++++++++++++++++++++ .../web/api/parentnode/lastelementchild/index.html | 94 +++++++++++++++++++++ .../api/parentnode/firstelementchild/index.html | 95 --------------------- .../web/api/parentnode/lastelementchild/index.html | 93 --------------------- 6 files changed, 219 insertions(+), 215 deletions(-) create mode 100644 files/zh-cn/orphaned/web/api/parentnode/firstelementchild/index.html create mode 100644 files/zh-cn/orphaned/web/api/parentnode/lastelementchild/index.html delete mode 100644 files/zh-cn/web/api/parentnode/firstelementchild/index.html delete mode 100644 files/zh-cn/web/api/parentnode/lastelementchild/index.html (limited to 'files/zh-cn') diff --git a/files/zh-cn/_redirects.txt b/files/zh-cn/_redirects.txt index e56379facf..5b42e7ce28 100644 --- a/files/zh-cn/_redirects.txt +++ b/files/zh-cn/_redirects.txt @@ -269,8 +269,8 @@ /zh-CN/docs/DOM/Document.querySelectorAll /zh-CN/docs/Web/API/Document/querySelectorAll /zh-CN/docs/DOM/Document.scripts /zh-CN/docs/Web/API/Document/scripts /zh-CN/docs/DOM/Element.children /zh-CN/docs/orphaned/Web/API/ParentNode/children -/zh-CN/docs/DOM/Element.firstElementChild /zh-CN/docs/Web/API/ParentNode/firstElementChild -/zh-CN/docs/DOM/Element.lastElementChild /zh-CN/docs/Web/API/ParentNode/lastElementChild +/zh-CN/docs/DOM/Element.firstElementChild /zh-CN/docs/orphaned/Web/API/ParentNode/firstElementChild +/zh-CN/docs/DOM/Element.lastElementChild /zh-CN/docs/orphaned/Web/API/ParentNode/lastElementChild /zh-CN/docs/DOM/Element.nextElementSibling /zh-CN/docs/Web/API/Element/nextElementSibling /zh-CN/docs/DOM/Element.querySelectorAll /zh-CN/docs/Web/API/Element/querySelectorAll /zh-CN/docs/DOM/EventTarget /zh-CN/docs/Web/API/EventTarget @@ -1726,10 +1726,12 @@ /zh-CN/docs/Web/API/OfflineAudioContext/complete /zh-CN/docs/Web/API/OfflineAudioContext/complete_event /zh-CN/docs/Web/API/ParentNode.childElementCount /zh-CN/docs/Web/API/Element/childElementCount /zh-CN/docs/Web/API/ParentNode.children /zh-CN/docs/orphaned/Web/API/ParentNode/children -/zh-CN/docs/Web/API/ParentNode.firstElementChild /zh-CN/docs/Web/API/ParentNode/firstElementChild -/zh-CN/docs/Web/API/ParentNode.lastElementChild /zh-CN/docs/Web/API/ParentNode/lastElementChild +/zh-CN/docs/Web/API/ParentNode.firstElementChild /zh-CN/docs/orphaned/Web/API/ParentNode/firstElementChild +/zh-CN/docs/Web/API/ParentNode.lastElementChild /zh-CN/docs/orphaned/Web/API/ParentNode/lastElementChild /zh-CN/docs/Web/API/ParentNode/childElementCount /zh-CN/docs/Web/API/Element/childElementCount /zh-CN/docs/Web/API/ParentNode/children /zh-CN/docs/orphaned/Web/API/ParentNode/children +/zh-CN/docs/Web/API/ParentNode/firstElementChild /zh-CN/docs/orphaned/Web/API/ParentNode/firstElementChild +/zh-CN/docs/Web/API/ParentNode/lastElementChild /zh-CN/docs/orphaned/Web/API/ParentNode/lastElementChild /zh-CN/docs/Web/API/Performance.now() /zh-CN/docs/Web/API/Performance/now /zh-CN/docs/Web/API/Performance/内存 /zh-CN/docs/Web/API/Performance/memory /zh-CN/docs/Web/API/Position /zh-CN/docs/Web/API/GeolocationPosition diff --git a/files/zh-cn/_wikihistory.json b/files/zh-cn/_wikihistory.json index 16eb345f2b..917102ab9b 100644 --- a/files/zh-cn/_wikihistory.json +++ b/files/zh-cn/_wikihistory.json @@ -16794,29 +16794,6 @@ "ziyunfei" ] }, - "Web/API/ParentNode/firstElementChild": { - "modified": "2020-10-15T21:06:48.165Z", - "contributors": [ - "igoryaodev", - "imwangpan", - "gwh1312", - "RainSlide", - "xgqfrms-GitHub", - "teoli", - "AlexChao", - "ziyunfei" - ] - }, - "Web/API/ParentNode/lastElementChild": { - "modified": "2020-10-15T21:05:51.837Z", - "contributors": [ - "RainSlide", - "xgqfrms-GitHub", - "teoli", - "khalid32", - "ziyunfei" - ] - }, "Web/API/ParentNode/prepend": { "modified": "2020-10-15T21:52:00.307Z", "contributors": [ @@ -50798,5 +50775,28 @@ "ziyunfei", "AlexChao" ] + }, + "orphaned/Web/API/ParentNode/firstElementChild": { + "modified": "2020-10-15T21:06:48.165Z", + "contributors": [ + "igoryaodev", + "imwangpan", + "gwh1312", + "RainSlide", + "xgqfrms-GitHub", + "teoli", + "AlexChao", + "ziyunfei" + ] + }, + "orphaned/Web/API/ParentNode/lastElementChild": { + "modified": "2020-10-15T21:05:51.837Z", + "contributors": [ + "RainSlide", + "xgqfrms-GitHub", + "teoli", + "khalid32", + "ziyunfei" + ] } } \ No newline at end of file diff --git a/files/zh-cn/orphaned/web/api/parentnode/firstelementchild/index.html b/files/zh-cn/orphaned/web/api/parentnode/firstelementchild/index.html new file mode 100644 index 0000000000..8e658b4adc --- /dev/null +++ b/files/zh-cn/orphaned/web/api/parentnode/firstelementchild/index.html @@ -0,0 +1,96 @@ +--- +title: Element.firstElementChild +slug: orphaned/Web/API/ParentNode/firstElementChild +translation_of: Web/API/ParentNode/firstElementChild +original_slug: Web/API/ParentNode/firstElementChild +--- +

{{ APIRef("DOM") }}

+ +

ParentNode.firstElementChild 只读属性,返回对象的第一个子 {{domxref("元素")}}, 如果没有子元素,则为null。

+ +
+

他的属性最初是在{{domxref("element遍历")}}纯接口中定义的。由于这个接口包含两组不同的属性,一个针对具有子元素的{{domxref("Node")}},一个针对子元素的属性,因此它们被移动到两个单独的纯接口中,{{domxref("ParentNode")}}和{{domxref("ChildNode")}}。在本例中,firstElementChild移动到{{domxref("ParentNode")}}。这是一个相当技术性的更改,不应该影响兼容性。

+
+ +

语法

+ +
var element = node.firstElementChild;
+
+ +

例子

+ +
<ul id="foo">
+  <li>First  (1)</li>
+  <li>Second (2)</li>
+  <li>Third  (3)</li>
+</ul>
+
+<script>
+var foo = document.getElementById('foo');
+// yields: First  (1)
+console.log(foo.firstElementChild.textContent);
+</script>
+
+ +

适用于 IE8、IE9 和 Safari 的 Polyfill

+ +
// Overwrites native 'firstElementChild' prototype.
+// Adds Document & DocumentFragment support for IE9 & Safari.
+// Returns array instead of HTMLCollection.
+;(function(constructor) {
+    if (constructor &&
+        constructor.prototype &&
+        constructor.prototype.firstElementChild == null) {
+        Object.defineProperty(constructor.prototype, 'firstElementChild', {
+            get: function() {
+                var node, nodes = this.childNodes, i = 0;
+                while (node = nodes[i++]) {
+                    if (node.nodeType === 1) {
+                        return node;
+                    }
+                }
+                return null;
+            }
+        });
+    }
+})(window.Node || window.Element);
+ +

规范

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('DOM WHATWG', '#dom-parentnode-firstelementchild', 'ParentNode.firstElementChild')}}{{Spec2('DOM WHATWG')}}Splitted the ElementTraversalinterface in {{domxref("ChildNode")}} and ParentNode. This method is now defined on the latter.
+ The {{domxref("Document")}} and {{domxref("DocumentFragment")}} implemented the new interfaces.
{{SpecName('Element Traversal', '#attribute-firstElementChild', 'ElementTraversal.firstElementChild')}}{{Spec2('Element Traversal')}}Added its initial definition to theElementTraversal pure interface and use it on {{domxref("Element")}}.
+ +

浏览器兼容性

+ + + +

{{Compat("api.ParentNode.firstElementChild")}}

+ +

参见

+ +

Ed

+ + diff --git a/files/zh-cn/orphaned/web/api/parentnode/lastelementchild/index.html b/files/zh-cn/orphaned/web/api/parentnode/lastelementchild/index.html new file mode 100644 index 0000000000..566d3a1976 --- /dev/null +++ b/files/zh-cn/orphaned/web/api/parentnode/lastelementchild/index.html @@ -0,0 +1,94 @@ +--- +title: Element.lastElementChild +slug: orphaned/Web/API/ParentNode/lastElementChild +translation_of: Web/API/ParentNode/lastElementChild +original_slug: Web/API/ParentNode/lastElementChild +--- +

{{ APIRef("DOM") }}

+ +

只读属性 ParentNode.lastElementChild 返回对象的最后一个子{{domxref("Element", "元素")}},如果没有子元素,则返回 null

+ +
+

This property was initially defined in the {{domxref("ElementTraversal")}} pure interface. As this interface contained two distinct set of properties, one aimed at {{domxref("Node")}} that have children, one at those that are children, they have been moved into two separate pure interfaces, {{domxref("ParentNode")}} and {{domxref("ChildNode")}}. In this case, lastElementChild moved to {{domxref("ParentNode")}}. This is a fairly technical change that shouldn't affect compatibility.

+
+ +

语法

+ +
var element = node.lastElementChild; 
+ +

例子

+ +
<ul id="foo">
+  <li>First  (1)</li>
+  <li>Second (2)</li>
+  <li>Third  (3)</li>
+</ul>
+
+<script>
+var foo = document.getElementById('foo');
+// yields: Third  (3)
+console.log(foo.lastElementChild.textContent);
+</script>
+
+ +

适用于 IE8、IE9 和 Safari 的 Polyfill

+ +
// Overwrites native 'lastElementChild' prototype.
+// Adds Document & DocumentFragment support for IE9 & Safari.
+// Returns array instead of HTMLCollection.
+;(function(constructor) {
+    if (constructor &&
+        constructor.prototype &&
+        constructor.prototype.lastElementChild == null) {
+        Object.defineProperty(constructor.prototype, 'lastElementChild', {
+            get: function() {
+                var node, nodes = this.childNodes, i = nodes.length - 1;
+                while (node = nodes[i--]) {
+                    if (node.nodeType === 1) {
+                        return node;
+                    }
+                }
+                return null;
+            }
+        });
+    }
+})(window.Node || window.Element);
+
+ +

规范

+ + + + + + + + + + + + + + + + + + + +
规范状态备注
{{SpecName('DOM WHATWG', '#dom-parentnode-lastelementchild', 'ParentNode.lastElementChild')}}{{Spec2('DOM WHATWG')}}Splitted the ElementTraversal interface in {{domxref("ChildNode")}} and ParentNode. This method is now defined on the latter.
+ The {{domxref("Document")}} and {{domxref("DocumentFragment")}} implemented the new interfaces.
{{SpecName('Element Traversal', '#attribute-lastElementChild', 'ElementTraversal.lastElementChild')}}{{Spec2('Element Traversal')}}Added its initial definition to the ElementTraversal pure interface and use it on {{domxref("Element")}}.
+ +

浏览器兼容性

+ + + +

{{Compat("api.ParentNode.lastElementChild")}}

+ +

参见

+ + diff --git a/files/zh-cn/web/api/parentnode/firstelementchild/index.html b/files/zh-cn/web/api/parentnode/firstelementchild/index.html deleted file mode 100644 index 1ff4b6f06f..0000000000 --- a/files/zh-cn/web/api/parentnode/firstelementchild/index.html +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: Element.firstElementChild -slug: Web/API/ParentNode/firstElementChild -translation_of: Web/API/ParentNode/firstElementChild ---- -

{{ APIRef("DOM") }}

- -

ParentNode.firstElementChild 只读属性,返回对象的第一个子 {{domxref("元素")}}, 如果没有子元素,则为null。

- -
-

他的属性最初是在{{domxref("element遍历")}}纯接口中定义的。由于这个接口包含两组不同的属性,一个针对具有子元素的{{domxref("Node")}},一个针对子元素的属性,因此它们被移动到两个单独的纯接口中,{{domxref("ParentNode")}}和{{domxref("ChildNode")}}。在本例中,firstElementChild移动到{{domxref("ParentNode")}}。这是一个相当技术性的更改,不应该影响兼容性。

-
- -

语法

- -
var element = node.firstElementChild;
-
- -

例子

- -
<ul id="foo">
-  <li>First  (1)</li>
-  <li>Second (2)</li>
-  <li>Third  (3)</li>
-</ul>
-
-<script>
-var foo = document.getElementById('foo');
-// yields: First  (1)
-console.log(foo.firstElementChild.textContent);
-</script>
-
- -

适用于 IE8、IE9 和 Safari 的 Polyfill

- -
// Overwrites native 'firstElementChild' prototype.
-// Adds Document & DocumentFragment support for IE9 & Safari.
-// Returns array instead of HTMLCollection.
-;(function(constructor) {
-    if (constructor &&
-        constructor.prototype &&
-        constructor.prototype.firstElementChild == null) {
-        Object.defineProperty(constructor.prototype, 'firstElementChild', {
-            get: function() {
-                var node, nodes = this.childNodes, i = 0;
-                while (node = nodes[i++]) {
-                    if (node.nodeType === 1) {
-                        return node;
-                    }
-                }
-                return null;
-            }
-        });
-    }
-})(window.Node || window.Element);
- -

规范

- - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('DOM WHATWG', '#dom-parentnode-firstelementchild', 'ParentNode.firstElementChild')}}{{Spec2('DOM WHATWG')}}Splitted the ElementTraversalinterface in {{domxref("ChildNode")}} and ParentNode. This method is now defined on the latter.
- The {{domxref("Document")}} and {{domxref("DocumentFragment")}} implemented the new interfaces.
{{SpecName('Element Traversal', '#attribute-firstElementChild', 'ElementTraversal.firstElementChild')}}{{Spec2('Element Traversal')}}Added its initial definition to theElementTraversal pure interface and use it on {{domxref("Element")}}.
- -

浏览器兼容性

- - - -

{{Compat("api.ParentNode.firstElementChild")}}

- -

参见

- -

Ed

- - diff --git a/files/zh-cn/web/api/parentnode/lastelementchild/index.html b/files/zh-cn/web/api/parentnode/lastelementchild/index.html deleted file mode 100644 index 57481ff762..0000000000 --- a/files/zh-cn/web/api/parentnode/lastelementchild/index.html +++ /dev/null @@ -1,93 +0,0 @@ ---- -title: Element.lastElementChild -slug: Web/API/ParentNode/lastElementChild -translation_of: Web/API/ParentNode/lastElementChild ---- -

{{ APIRef("DOM") }}

- -

只读属性 ParentNode.lastElementChild 返回对象的最后一个子{{domxref("Element", "元素")}},如果没有子元素,则返回 null

- -
-

This property was initially defined in the {{domxref("ElementTraversal")}} pure interface. As this interface contained two distinct set of properties, one aimed at {{domxref("Node")}} that have children, one at those that are children, they have been moved into two separate pure interfaces, {{domxref("ParentNode")}} and {{domxref("ChildNode")}}. In this case, lastElementChild moved to {{domxref("ParentNode")}}. This is a fairly technical change that shouldn't affect compatibility.

-
- -

语法

- -
var element = node.lastElementChild; 
- -

例子

- -
<ul id="foo">
-  <li>First  (1)</li>
-  <li>Second (2)</li>
-  <li>Third  (3)</li>
-</ul>
-
-<script>
-var foo = document.getElementById('foo');
-// yields: Third  (3)
-console.log(foo.lastElementChild.textContent);
-</script>
-
- -

适用于 IE8、IE9 和 Safari 的 Polyfill

- -
// Overwrites native 'lastElementChild' prototype.
-// Adds Document & DocumentFragment support for IE9 & Safari.
-// Returns array instead of HTMLCollection.
-;(function(constructor) {
-    if (constructor &&
-        constructor.prototype &&
-        constructor.prototype.lastElementChild == null) {
-        Object.defineProperty(constructor.prototype, 'lastElementChild', {
-            get: function() {
-                var node, nodes = this.childNodes, i = nodes.length - 1;
-                while (node = nodes[i--]) {
-                    if (node.nodeType === 1) {
-                        return node;
-                    }
-                }
-                return null;
-            }
-        });
-    }
-})(window.Node || window.Element);
-
- -

规范

- - - - - - - - - - - - - - - - - - - -
规范状态备注
{{SpecName('DOM WHATWG', '#dom-parentnode-lastelementchild', 'ParentNode.lastElementChild')}}{{Spec2('DOM WHATWG')}}Splitted the ElementTraversal interface in {{domxref("ChildNode")}} and ParentNode. This method is now defined on the latter.
- The {{domxref("Document")}} and {{domxref("DocumentFragment")}} implemented the new interfaces.
{{SpecName('Element Traversal', '#attribute-lastElementChild', 'ElementTraversal.lastElementChild')}}{{Spec2('Element Traversal')}}Added its initial definition to the ElementTraversal pure interface and use it on {{domxref("Element")}}.
- -

浏览器兼容性

- - - -

{{Compat("api.ParentNode.lastElementChild")}}

- -

参见

- - -- cgit v1.2.3-54-g00ecf