aboutsummaryrefslogtreecommitdiff
path: root/files/it/web/api/document/documentelement/index.html
blob: e48895b7a0fa84c3f6705f5b598e31b2c52e8d62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
title: Document.documentElement
slug: Web/API/Document/documentElement
translation_of: Web/API/Document/documentElement
---
<div>{{ApiRef("DOM")}}</div>

<p><strong><code>Document.documentElement</code></strong> ritorna l'{{domxref("Element")}} che è l'elemento principale di {{domxref("document")}} (per esempio, l'elemento {{HTMLElement("html")}} per i documenti HTML).</p>

<h2 id="Sintassi">Sintassi</h2>

<pre class="syntaxbox">var <var>element</var> = <var>document</var>.documentElement;
</pre>

<h2 id="Esempio">Esempio</h2>

<pre class="brush:js">var rootElement = document.documentElement;
var firstTier = rootElement.childNodes;

// firstTier è la NodeList dei figli diretti dell'elemento root
for (var i = 0; i &lt; firstTier.length; i++) {
   // fare qualcosa con ogni child diretto dell'elemento radice
   // come firstTier[i]
}</pre>

<h2 id="Appunti">Appunti</h2>

<p>Per qualsiasi documento HTML non vuoto, <code>document.documentElement</code> sarà sempre un elemento {{HTMLElement("html")}}. Per qualsiasi documento XML non vuoto, <code>document.documentElement</code> sarà sempre qualunque elemento sia l'elemento radice del documento.</p>

<h2 id="Specifiche">Specifiche</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specifica</th>
   <th scope="col">Stato</th>
   <th scope="col">Commento</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('DOM WHATWG','#dom-document-documentelement','Document.documentElement')}}</td>
   <td>{{Spec2('DOM WHATWG')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('DOM4','#dom-document-documentelement','Document.documentElement')}}</td>
   <td>{{Spec2('DOM4')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('DOM3 Core','core.html#ID-87CD092','Document.documentElement')}}</td>
   <td>{{Spec2('DOM3 Core')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('DOM2 Core','core.html#ID-87CD092','Document.documentElement')}}</td>
   <td>{{Spec2('DOM2 Core')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="Compatibilità_con_i_browser">Compatibilità con i browser</h2>



<p>{{Compat("api.Document.documentElement")}}</p>