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 --- .../api/parentnode/firstelementchild/index.html | 100 +++++++++++++++++++++ .../web/api/parentnode/lastelementchild/index.html | 99 ++++++++++++++++++++ 2 files changed, 199 insertions(+) create mode 100644 files/it/orphaned/web/api/parentnode/firstelementchild/index.html create mode 100644 files/it/orphaned/web/api/parentnode/lastelementchild/index.html (limited to 'files/it/orphaned') diff --git a/files/it/orphaned/web/api/parentnode/firstelementchild/index.html b/files/it/orphaned/web/api/parentnode/firstelementchild/index.html new file mode 100644 index 0000000000..4a76fb11dd --- /dev/null +++ b/files/it/orphaned/web/api/parentnode/firstelementchild/index.html @@ -0,0 +1,100 @@ +--- +title: ParentNode.firstElementChild +slug: orphaned/Web/API/ParentNode/firstElementChild +tags: + - API + - DOM + - ParentNode + - Proprietà +translation_of: Web/API/ParentNode/firstElementChild +original_slug: Web/API/ParentNode/firstElementChild +--- +

{{ APIRef("DOM") }}

+ +

La proprietà ParentNode.firstElementChild di sola lettura restituisce il primo figlio {{domxref("Element")}} dell'oggetto, oppure null se non ha elementi figli.

+ +
+

Questa proprietà era inizialmente definita nell'interfaccia pura {{domxref("ElementTraversal")}} pure interface. Poiché questa interfaccia conteneva due distinti set di proprietà, una diretta al {{domxref("Node")}} che ha figli, una a quelli che sono figli, sono stati spostati in due interfacce pure separate, {{domxref("ParentNode")}} e {{domxref("ChildNode")}}. In questo caso, firstElementChild è stato spostato su {{domxref("ParentNode")}}. Questa è una modifica abbastanza tecnica che non dovrebbe influire sulla compatibilità.

+
+ +

Sintassi

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

Esempio

+ +
<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>
+
+ +

Polyfill per IE8, IE9 e Safari

+ +
// 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);
+
+ +

Specifiche

+ + + + + + + + + + + + + + + + + + + +
SpecificaStatoCommento
{{SpecName('DOM WHATWG', '#dom-parentnode-firstelementchild', 'ParentNode.firstElementChild')}}{{Spec2('DOM WHATWG')}}Diviso l'interfaccia ElementTraversal in {{domxref("ChildNode")}} e ParentNode. Questo metodo è ora definito su quest'ultimo.
+ Il {{domxref("Document")}} e {{domxref("DocumentFragment")}} implementato le nuove interfacce.
{{SpecName('Element Traversal', '#attribute-firstElementChild', 'ElementTraversal.firstElementChild')}}{{Spec2('Element Traversal')}}Aggiunta la sua definizione iniziale all'interfaccia pura ElementTraversal e usarla su {{domxref("Element")}}.
+ +

Compatibilità con i browser

+ + + +

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

+ +

Vedi anche

+ + diff --git a/files/it/orphaned/web/api/parentnode/lastelementchild/index.html b/files/it/orphaned/web/api/parentnode/lastelementchild/index.html new file mode 100644 index 0000000000..d1876d8164 --- /dev/null +++ b/files/it/orphaned/web/api/parentnode/lastelementchild/index.html @@ -0,0 +1,99 @@ +--- +title: ParentNode.lastElementChild +slug: orphaned/Web/API/ParentNode/lastElementChild +tags: + - API + - DOM + - ParentNode + - Proprietà +translation_of: Web/API/ParentNode/lastElementChild +original_slug: Web/API/ParentNode/lastElementChild +--- +

{{ APIRef("DOM") }}

+ +

La proprietà ParentNode.LastElementChild di sola lettura restituisce l'ultimo figlio Element dell'oggetto, oppure null se non ha elementi figli.

+ +
+

Questa proprietà era inizialmente definita nell'interfaccia pura {{domxref("ElementTraversal")}} pure interface. Poiché questa interfaccia conteneva due distinti set di proprietà, una diretta al {{domxref("Node")}} che ha figli, una a quelli che sono figli, sono stati spostati in due interfacce pure separate, {{domxref("ParentNode")}} e {{domxref("ChildNode")}}. In questo caso, lastElementChild è stato spostato su {{domxref("ParentNode")}}. Questa è una modifica abbastanza tecnica che non dovrebbe influire sulla compatibilità.

+
+ +

Sintassi

+ +
var element = node.lastElementChild; 
+ +

Esempio

+ +
<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>
+
+ +

Polyfill per IE8, IE9 e Safari

+ +
// 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);
+
+ +

Specifiche

+ + + + + + + + + + + + + + + + + + + +
SpecificaStatoCommento
{{SpecName('DOM WHATWG', '#dom-parentnode-firstelementchild', 'ParentNode.firstElementChild')}}{{Spec2('DOM WHATWG')}}Diviso l'interfaccia ElementTraversal in {{domxref("ChildNode")}} e ParentNode. Questo metodo è ora definito su quest'ultimo.
+ Il {{domxref("Document")}} e {{domxref("DocumentFragment")}} implementato le nuove interfacce.
{{SpecName('Element Traversal', '#attribute-firstElementChild', 'ElementTraversal.firstElementChild')}}{{Spec2('Element Traversal')}}Aggiunta la sua definizione iniziale all'interfaccia pura ElementTraversal e usarla su {{domxref("Element")}}.
+ +

Compatibilità con i browser

+ + + +

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

+ +

Vedi anche

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