From db26cf86829f9b43d29f18b9bbf197e9e2d55c31 Mon Sep 17 00:00:00 2001 From: MDN Date: Wed, 14 Apr 2021 00:11:31 +0000 Subject: [CRON] sync translated content --- files/zh-tw/web/api/parentnode/children/index.html | 152 --------------------- 1 file changed, 152 deletions(-) delete mode 100644 files/zh-tw/web/api/parentnode/children/index.html (limited to 'files/zh-tw/web/api/parentnode') diff --git a/files/zh-tw/web/api/parentnode/children/index.html b/files/zh-tw/web/api/parentnode/children/index.html deleted file mode 100644 index f9f6c76115..0000000000 --- a/files/zh-tw/web/api/parentnode/children/index.html +++ /dev/null @@ -1,152 +0,0 @@ ---- -title: ParentNode.children -slug: Web/API/ParentNode/children -translation_of: Web/API/ParentNode/children ---- -

{{ APIRef("DOM") }}

- -

Node.children 唯讀屬性會回傳一個 Node 之子{{domxref("Element","元素")}}的動態(live){{domxref("HTMLCollection")}}。

- -

語法

- -
var children = node.children;
- -

children 是一個 {{ domxref("HTMLCollection") }},為一個有順序性、由 node 中的 DOM 子元素所組成的集合。假如沒有子元素,則 children 內便不包含任何元素,且 length0

- -

範例

- -
var foo = document.getElementById('foo');
-for (var i = 0; i < foo.children.length; i++) {
-    console.log(foo.children[i].tagName);
-}
-
- -

Polyfill

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

規範

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('DOM WHATWG', '#dom-parentnode-children', 'ParentNode.children')}}{{Spec2('DOM WHATWG')}}Initial definition.
- -

瀏覽器相容性

- -

{{ CompatibilityTable() }}

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerEdgeOperaSafari
Basic support (on {{domxref("Element")}})1.0{{CompatGeckoDesktop("1.9.1")}}9.0 [1]38.010.04.0
Support on {{domxref("Document")}} and {{domxref("DocumentFragment")}} {{experimental_inline}}29.0{{CompatGeckoDesktop("25.0")}}{{CompatNo}}{{CompatNo}}16.0{{CompatNo}}
Support on {{domxref("SVGElement")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatNo}}{{CompatNo}}{{CompatUnknown}}{{CompatNo}}
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support (on {{domxref("Element")}}){{ CompatVersionUnknown() }}{{CompatGeckoMobile("1.9.1")}}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}
Support on {{domxref("Document")}} and {{domxref("DocumentFragment")}} {{experimental_inline}}{{CompatVersionUnknown}}{{CompatGeckoMobile("25.0")}}{{CompatNo}}16.0{{CompatNo}}
-
- -

[1] Internet Explorer 6, 7 and 8 supported it, but erroneously includes {{domxref("Comment")}} nodes.

- -

參見

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