aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/api/document/documentelement/index.html
blob: 429fce87c4d0fad4bb12bd12231d296d39dcbd85 (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
---
title: Document.documentElement
slug: Web/API/Document/documentElement
tags:
  - API
  - DOM
  - Document
  - Property
  - Reference
  - ㅈ
translation_of: Web/API/Document/documentElement
---
<div>{{ApiRef("DOM")}}</div>

<p><code><strong>Document.documentElement</strong></code> 읽기 전용 속성은 <a href="/ko/docs/Web/API/Document">문서</a>의 루트 요소를 나타내는 {{domxref("Element")}}를 반환합니다. HTML 문서를 예로 들면 {{htmlelement("html")}} 요소를 반환합니다.</p>

<h2 id="구문">구문</h2>

<pre class="syntaxbox">const <em>element</em> = document.documentElement
</pre>

<h2 id="예제">예제</h2>

<pre class="brush:js">const rootElement = document.documentElement;
const firstTier = rootElement.childNodes;
// firstTier is a NodeList of the direct children of the root element
// such as &lt;head&gt; and &lt;body&gt;

for (const child of firstTier) {
   // do something with each direct child of the root element
}</pre>

<h2 id="참고">참고</h2>

<p>모든 비어있지 않은 HTML 문서의 <code>documentElement</code>는 항상 {{htmlelement("html")}} 요소를 가리킵니다. 모든 비어있지 않은 XML 문서의 <code>documentElement</code>는 종류불문하고 해당 문서의 루트 요소를 가리킵니다.</p>

<h2 id="명세">명세</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('DOM WHATWG','#dom-document-documentelement','Document.documentElement')}}</td>
   <td>{{Spec2('DOM WHATWG')}}</td>
   <td></td>
  </tr>
 </tbody>
</table>

<h2 id="브라우저_호환성">브라우저 호환성</h2>



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