Document 객체

Document 객체는 DOM의 스펙이고 이것이 웹 브라우저에서는 HTMLDocument 객체로 사용된다. HTMLDocument 객체는 문서 전체를 대표하는 객체라고 할 수 있다. (window 객체의 프로퍼티이기도 하다.)

<script>
console.log(window.document);
console.log(document.childNodes); // Doctype, HTML
console.log(document.childNodes[0]); // Doctype
console.log(document.childNodes[1]); // HTML

-> 문서의 내용을 품고 있는 객체

주요 API

노드 생성 API

새로운 노드를 생성해주는 역할. [노드 변경 API] 부분에서 언급했었음.

  • createElement()

  • createTextNode()

문서 정보 API

  • title, URL, referrer (어떤 사이트를 경유해서 이 페이지에 왔는지), lastModified

results matching ""

    No results matching ""