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-tw/_redirects.txt | 1 + files/zh-tw/_wikihistory.json | 12 +-- .../api/parentnode/firstelementchild/index.html | 96 ++++++++++++++++++++++ .../api/parentnode/firstelementchild/index.html | 95 --------------------- 4 files changed, 103 insertions(+), 101 deletions(-) create mode 100644 files/zh-tw/orphaned/web/api/parentnode/firstelementchild/index.html delete mode 100644 files/zh-tw/web/api/parentnode/firstelementchild/index.html (limited to 'files/zh-tw') diff --git a/files/zh-tw/_redirects.txt b/files/zh-tw/_redirects.txt index 24c794b2b8..49ffb976ba 100644 --- a/files/zh-tw/_redirects.txt +++ b/files/zh-tw/_redirects.txt @@ -577,6 +577,7 @@ /zh-TW/docs/Web/API/Node/innerText /zh-TW/docs/Web/API/HTMLElement/innerText /zh-TW/docs/Web/API/NonDocumentTypeChildNode /zh-TW/docs/conflicting/Web/API/Element /zh-TW/docs/Web/API/ParentNode/children /zh-TW/docs/orphaned/Web/API/ParentNode/children +/zh-TW/docs/Web/API/ParentNode/firstElementChild /zh-TW/docs/orphaned/Web/API/ParentNode/firstElementChild /zh-TW/docs/Web/API/Performance.timing /zh-TW/docs/Web/API/Performance/timing /zh-TW/docs/Web/API/Position /zh-TW/docs/Web/API/GeolocationPosition /zh-TW/docs/Web/API/Position/coords /zh-TW/docs/Web/API/GeolocationPosition/coords diff --git a/files/zh-tw/_wikihistory.json b/files/zh-tw/_wikihistory.json index f702d4e4df..e287862822 100644 --- a/files/zh-tw/_wikihistory.json +++ b/files/zh-tw/_wikihistory.json @@ -4233,12 +4233,6 @@ "jackblackevo" ] }, - "Web/API/ParentNode/firstElementChild": { - "modified": "2020-10-15T22:25:38.862Z", - "contributors": [ - "ianchen0119" - ] - }, "Web/API/PaymentRequest": { "modified": "2020-10-15T22:13:15.817Z", "contributors": [ @@ -9152,5 +9146,11 @@ "contributors": [ "jackblackevo" ] + }, + "orphaned/Web/API/ParentNode/firstElementChild": { + "modified": "2020-10-15T22:25:38.862Z", + "contributors": [ + "ianchen0119" + ] } } \ No newline at end of file diff --git a/files/zh-tw/orphaned/web/api/parentnode/firstelementchild/index.html b/files/zh-tw/orphaned/web/api/parentnode/firstelementchild/index.html new file mode 100644 index 0000000000..ca33d60793 --- /dev/null +++ b/files/zh-tw/orphaned/web/api/parentnode/firstelementchild/index.html @@ -0,0 +1,96 @@ +--- +title: ParentNode.firstElementChild +slug: orphaned/Web/API/ParentNode/firstElementChild +translation_of: Web/API/ParentNode/firstElementChild +original_slug: Web/API/ParentNode/firstElementChild +--- +

{{ APIRef("DOM") }}

+ +

ParentNode.firstElementChild 介面會會返回 ParentNode的第一個子元素(唯讀) ,如果該節點沒有子節點則返回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, firstElementChild moved to {{domxref("ParentNode")}}. This is a fairly technical change that shouldn't affect compatibility.

+
+ +

語法

+ +
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.
+;(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')}}Split 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-firstElementChild', 'ElementTraversal.firstElementChild')}}{{Spec2('Element Traversal')}}Added its initial definition to the ElementTraversal pure interface and use it on {{domxref("Element")}}.
+ +

瀏覽器相容性

+ + + +

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

+ +

參見

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

{{ APIRef("DOM") }}

- -

ParentNode.firstElementChild 介面會會返回 ParentNode的第一個子元素(唯讀) ,如果該節點沒有子節點則返回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, firstElementChild moved to {{domxref("ParentNode")}}. This is a fairly technical change that shouldn't affect compatibility.

-
- -

語法

- -
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.
-;(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')}}Split 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-firstElementChild', 'ElementTraversal.firstElementChild')}}{{Spec2('Element Traversal')}}Added its initial definition to the ElementTraversal pure interface and use it on {{domxref("Element")}}.
- -

瀏覽器相容性

- - - -

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

- -

參見

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