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 --- .../web/api/parentnode/children/index.html | 96 ++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 files/it/orphaned/web/api/parentnode/children/index.html (limited to 'files/it/orphaned') diff --git a/files/it/orphaned/web/api/parentnode/children/index.html b/files/it/orphaned/web/api/parentnode/children/index.html new file mode 100644 index 0000000000..d5df5c6364 --- /dev/null +++ b/files/it/orphaned/web/api/parentnode/children/index.html @@ -0,0 +1,96 @@ +--- +title: ParentNode.children +slug: orphaned/Web/API/ParentNode/children +tags: + - API + - Child + - Child Nodes + - DOM + - HTMLCollection + - Node + - ParentNode + - Proprietà + - children +translation_of: Web/API/ParentNode/children +original_slug: Web/API/ParentNode/children +--- +
{{ APIRef("DOM") }}
+ +

La proprietà {{domxref("ParentNode")}} children è una proprietà di sola lettura che restituisce una {{domxref("HTMLCollection")}} dinamica che contiene tutti gli {{domxref("Element","elements")}} figli del nodo su cui è stato chiamato.

+ +

Sintassi

+ +
var children = node.children;
+ +

Valore

+ +

Una {{ domxref("HTMLCollection") }} che è dimanica, raccolta ordinata degli elementi DOM che sono figli di node. È possibile accedere ai singoli nodi figlio nella raccolta utilizzando il metodo {{domxref("HTMLCollection.item", "item()")}} nella collezione o utilizzando la notazione in stile array JavaScript.

+ +

Se il nodo non ha elementi figli, children è una lista vuota con una length di 0.

+ +

Esempio

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

Polyfill

+ +
// Sovrascrive il prototipo nativo di "children".
+// Aggiunge il supporto Document e DocumentFragment per IE9 & Safari.
+// Restituisce un array invece di una 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);
+
+ +

Specifiche

+ + + + + + + + + + + + + + +
SpecificaStatoCommento
{{SpecName('DOM WHATWG', '#dom-parentnode-children', 'ParentNode.children')}}{{Spec2('DOM WHATWG')}}Definizione iniziale.
+ +

Compatibilità con i browser

+ + + +

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

+ +

Vedi anche

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