Document
인터페이스는 브라우저가 불러온 웹 페이지를 나타내며, 페이지 콘텐츠(DOM 트리)의 진입점 역할을 수행합니다. DOM 트리는 <body>
와 <table>
및 여러 다른 요소를 포함합니다. Document
는 페이지의 URL을 얻거나 문서에 새로운 요소를 생성하는 등의 기능을 전역적으로 제공합니다.
Document
인터페이스는 모든 종류의 문서에 대한 공통의 속성과 메서드를 묘사합니다. 문서의 유형(HTML, XML, SVG 등)에 따라서 더 다양한 API가 존재합니다. 예컨대 "text/html"
콘텐츠 유형으로 제공되는 HTML 문서는 HTMLDocument
인터페이스도 구현하는 반면, XML과 SVG 문서는 XMLDocument
인터페이스를 구현합니다.
생성자
Document()
- 새로운
Document
객체를 생성합니다.
속성
Documet
는 Node
와 EventTarget
인터페이스도 상속합니다.
Document.anchors
Read only- 문서 내 모든 앵커의 목록을 반환합니다.
Document.body
- 현재 문서의
<body>
또는<frameset>
노드를 반환합니다. Document.characterSet
Read only- 문서에서 사용하는 캐릭터셋을 반환합니다.
Document.compatMode
Read only- 문서의 렌더링 모드가 Quirks와 Strict 중 어떤 것인지 반환합니다.
Document.contentType
Read only- 현재 문서의 MIME 헤더로부터
Content-Type
을 반환합니다. Document.doctype
Read only- 현재 문서의 문서 형식 정의(Document Type Definition, DTD)를 반환합니다.
Document.documentElement
Read only- 문서의 직속 자식인
Element
를 반환합니다. HTML 문서에서는 보통<html>
요소를 나타내는HTMLHtmlElement
객체입니다. Document.documentURI
Read only- 문서의 위치를 문자열로 반환합니다.
Document.embeds
Read only- 현재 문서에 포함된
<embed>
요소 목록을 반환합니다. Document.fonts
- 현재 문서의
FontFaceSet
인터페이스를 반환합니다. Document.forms
Read only- 현재 문서의
<form>
요소 목록을 반환합니다. Document.head
Read only- 현재 문서의
<head>
요소를 반환합니다. Document.hidden
Read only- 현재 문서의 숨김 여부를 반환합니다.
Document.images
Read only- 현재 문서의 이미지 목록을 반환합니다.
Document.implementation
Read only- 현재 문서와 연관된 DOM 구현을 반환합니다.
Document.lastStyleSheetSet
Read only- 마지막에 활성화된 스타일 시트 세트의 이름을 반환합니다.
selectedStyleSheetSet
값을 설정하여 스타일 시트가 변경되기 전에는null
값을 갖습니다. Document.links
Read only- 문서의 모든 하이퍼링크 목록을 반환합니다.
Document.mozSyntheticDocument
- 문서가 synthetic, 즉 단일 이미지, 비디오, 오디오 파일이나 이와 비슷한 것인 경우
Boolean
true
를 반환합니다. Document.plugins
Read only- 사용 가능한 플러그인의 목록을 반환합니다.
Document.policy
Read only- 특정 문서에 적용되는 기능 정책을 자성하기 위한 간단한 API 를 제공하는
Policy
인터페이스를 반환합니다. Document.preferredStyleSheetSet
Read only- 페이지 작성자가 지정한 선호 스타일 시트 세트를 반환합니다.
Document.scripts
Read only- 문서의 모든
<script>
요소를 반환합니다. Document.scrollingElement
Read only- 문서를 스크롤 하는
Element
에 대한 참조를 반환합니다. Document.selectedStyleSheetSet
- 현재 사용 중인 스타일 시트 세트를 반환합니다.
Document.styleSheetSets
Read only- 문서에서 사용 가능한 스타일 시트 세트의 목록을 반환합니다.
Document.timeline
Read only- 페이지 로드 시 자동으로 생성하는
DocumentTimeline
의 인스턴스를 반환합니다. Document.undoManager
Read only- …
Document.visibilityState
Read only- 문서의 표시 상태를 나타내는 문자열을 반환합니다. 가능한 값은
visible
,hidden
,prerender
,unloaded
입니다.
Document
인터페이스는 ParentNode
인터페이스를 확장합니다.
ParentNode.childElementCount
Read onlyParentNode
가 가진 자식 중 요소의 수를 반환합니다.ParentNode.children
Read onlyParentNode
가 가진 모든 자식 중 요소만 모은HTMLCollection
을 반환합니다.ParentNode.firstElementChild
Read onlyParentNode
의 자식이자Element
인 객체 중 첫 번째를 반환합니다. 만족하는 자식이 없으면null
을 반환합니다.ParentNode.lastElementChild
Read onlyParentNode
의 자식이자Element
인 객체 중 마지막을 반환합니다. 만족하는 자식이 없으면null
을 반환합니다.
HTMLDocument 확장
HTML 문서를 위한 Document
인터페이스는 HTML5 이전엔 HTMLDocument
인터페이스를 상속하고, 이후로는 확장합니다.
Document.cookie
- 문서의 쿠키 리스트를 세미콜론으로 분리해 반환하거나, 하나의 쿠키를 설정합니다.
Document.defaultView
Read onlyWindow
객체의 참조를 반환합니다.Document.designMode
- 문서 전체의 수정 가능 여부를 설정/반환합니다.
Document.dir
- 문서의 쓰기 방향(rtl/ltr)을 설정/반환합니다.
Document.domain
- 현재 문서의 도메인을 설정/반환합니다.
Document.lastModified
Read only- 문서가 마지막으로 수정된 날짜를 반환합니다.
Document.location
Read only- 현재 문서의 URI를 반환합니다.
Document.readyState
Read only- 문서의 불러오기 상태를 반환합니다.
Document.referrer
Read only- 현재 페이지로 연결한 페이지의 URI를 반환합니다.
Document.title
- 문서의 제목을 설정하거나 반환합니다.
Document.URL
Read only- 문서의 위치를 문자열로 반환합니다.
DocumentOrShadowRoot에서 포함한 속성
Document
인터페이스는 DocumentOrShadowRoot
믹스인이 정의하는 다음의 속성을 포함합니다. 지금은 Chrome만 DocumentOrShadowRoot
믹스인으로 구현한 상태라는 점에 유의하세요. 다른 브라우저는 Document
인터페이스에 직접 구현합니다.
DocumentOrShadowRoot.activeElement
Read only- 섀도 트리 내에서 포커스를 가진
Element
를 반환합니다. Document.fullscreenElement
Read only- 현재 문서에서 전체 화면 모드 중인 요소를 반환합니다.
DocumentOrShadowRoot.pointerLockElement
Read only- 포인터가 잠긴 동안 마우스 이벤트의 대상으로 설정한 요소를 반환합니다. 잠금 대기 중이거나, 포인터의 잠금이 해제됐거나, 대상이 다른 문서에 존재하는 경우
null
입니다. DocumentOrShadowRoot.styleSheets
Read only- 문서가 포함하거나 명시적으로 연결한 스타일 시트를 나타내는,
CSSStyleSheet
의StyleSheetList
객체를 반환합니다.
이벤트 처리기
Document.onafterscriptexecute
afterscriptexecute
이벤트를 위한 이벤트 핸들링 코드를 나타냅니다.Document.onbeforescriptexecute
beforescriptexecute
이벤트를 위한 이벤트 핸들링 코드를 나타냅니다.Document.oncopy
copy
이벤트를 위한 이벤트 핸들링 코드를 나타냅니다.Document.oncut
cut
이벤트를 위한 이벤트 핸들링 코드를 나타냅니다.Document.onfullscreenchange
fullscreenchange
이벤트가 발생할 때 호출되는 코드를 나타내는EventHandler
입니다.Document.onfullscreenerror
fullscreenerror
이벤트가 발생할 때 호출되는 코드를 나타내는EventHandler
입니다.Document.onpaste
paste
이벤트를 위한 이벤트 핸들링 코드를 나타냅니다.Document.onreadystatechange
readystatechange
이벤트를 위한 이벤트 핸들링 코드를 나타냅니다.Document.onselectionchange
selectionchange
이벤트가 발생할 때 호출되는 코드를 나타내는EventHandler
입니다.Document.onvisibilitychange
visibilitychange
이벤트가 발생할 때 호출되는 코드를 나타내는EventHandler
입니다.
Document
인터페이스는 GlobalEventHandlers
인터페이스를 확장합니다.
이 인터페이스는 아래에 나열된 이벤트 처리기를 위한 속성만을 갖습니다.
이벤트 처리기
다음 이벤트 처리기들은 GlobalEventHandlers
믹스인이 정의하고, HTMLElement
, Document
, Window
와 웹 워커의 WorkerGlobalScope
가 구현합니다.
GlobalEventHandlers.onabort
abort
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onanimationcancel
- 실행 중이던 CSS 애니메이션이 취소됐음을 알리는
animationcancel
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
. GlobalEventHandlers.onanimationend
- 실행 중이던 CSS 애니메이션이 끝났음을 알리는
animationend
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
. GlobalEventHandlers.onanimationiteration
- 실행 중인 CSS 애니메이션의 다음 회차 재생이 시작됐음을 알리는
animationiteration
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
. GlobalEventHandlers.onanimationstart
- CSS 애니메이션의 재생이 시작됐음을 알리는
animationstart
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
. GlobalEventHandlers.onauxclick
- 마우스 휠 클릭 등 비주요 버튼이 눌렸음을 알리는
auxclick
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
. GlobalEventHandlers.onblur
blur
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onerror
error
이벤트가 발생했을 때 호출할 코드를 나타내는OnErrorEventHandler
.GlobalEventHandlers.onfocus
focus
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.oncancel
cancel
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.oncanplay
canplay
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.oncanplaythrough
canplaythrough
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onchange
change
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onclick
click
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onclose
close
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.oncontextmenu
contextmenu
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.oncuechange
cuechange
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ondblclick
dblclick
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ondrag
drag
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ondragend
dragend
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ondragenter
dragenter
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ondragexit
dragexit
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ondragleave
dragleave
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ondragover
dragover
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ondragstart
dragstart
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ondrop
drop
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ondurationchange
durationchange
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onemptied
emptied
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onended
ended
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ongotpointercapture
-
gotpointercapture
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
. GlobalEventHandlers.oninput
input
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.oninvalid
invalid
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onkeydown
keydown
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onkeypress
keypress
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onkeyup
keyup
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onload
load
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onloadeddata
loadeddata
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onloadedmetadata
loadedmetadata
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onloadend
- 자원의 불러오기가 멈췄음을 나타내는
loadend
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
. GlobalEventHandlers.onloadstart
- 자원을 불러오기 시작함을 나타내는
loadstart
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
. GlobalEventHandlers.onlostpointercapture
-
lostpointercapture
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
. GlobalEventHandlers.onmousedown
mousedown
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onmouseenter
mouseenter
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onmouseleave
mouseleave
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onmousemove
mousemove
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onmouseout
mouseout
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onmouseover
mouseover
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onmouseup
mouseup
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onmousewheel
mousewheel
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.onwheel
을 대신 사용하세요.GlobalEventHandlers.onwheel
wheel
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onpause
pause
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onplay
play
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onplaying
playing
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onpointerdown
pointerdown
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onpointermove
pointermove
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onpointerup
pointerup
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onpointercancel
pointercancel
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onpointerover
pointerover
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onpointerout
pointerout
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onpointerenter
pointerenter
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onpointerleave
pointerleave
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onpointerlockchange
pointerlockchange
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onpointerlockerror
pointerlockerror
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onprogress
progress
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onratechange
ratechange
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onreset
reset
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onresize
resize
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onscroll
scroll
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onseeked
seeked
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onseeking
seeking
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onselect
select
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onselectstart
- 사용자가 웹 페이지의 텍스트 등을 선택하기 시작함을 나타내는
selectionchange
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
. GlobalEventHandlers.onselectionchange
- 웹 페이지의 선택 영역(텍스트 등)이 바뀌었음을 나타내는
selectionchange
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
. GlobalEventHandlers.onshow
show
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onsort
sort
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onstalled
stalled
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onsubmit
submit
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onsuspend
suspend
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ontimeupdate
timeupdate
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.onvolumechange
volumechange
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ontouchcancel
touchcancel
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ontouchend
touchend
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ontouchmove
touchmove
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ontouchstart
touchstart
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.GlobalEventHandlers.ontransitioncancel
- CSS 트랜지션이 취소됐음을 알리는
transitioncancel
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
. GlobalEventHandlers.ontransitionend
- CSS 트랜지션이 끝났음을 알리는
transitionend
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
. GlobalEventHandlers.onwaiting
waiting
이벤트가 발생했을 때 호출할 코드를 나타내는EventHandler
.
사용하지 않는 속성
Document.alinkColor
- 다큐먼트 바디에 있는 활성 링크의 색상을 설정하거나 반환합니다.
Document.all
- 다큐먼트의 모든 엘리먼트로의 접근을 제공합니다. 레거시이며 비표준 속성이므로 사용되면 안됩니다.
Document.applets
Read only- 다큐먼트에 있는 애플릿의 정렬된 리스트를 반환합니다.
Document.async
Document.load
와 사용되어 비동기 요청을 나타냅니다.Document.bgColor
- 현재 다큐먼트의 배경 색상을 설정하거나 반환합니다.
Document.charset
Read onlyDocument.characterSet
과 동일합니다.Document.characterSet
속성을 사용하시기 바랍니다.Document.domConfig
DOMConfiguration
객체를 반환합니다.document.fgColor
- 현재 다큐먼트의 foreground 색상이나 텍스트 색상을 설정하거나 반환합니다.
Document.fullscreen
- 다큐먼트가
full-screen mode
에 있을 때true
를 반환합니다. Document.height
- 현재 다큐먼트의 높이를 설정하거나 반환합니다.
Document.inputEncoding
Read onlyDocument.characterSet
과 동일합니다.Document.characterSet
속성을 사용하시기 바랍니다.Document.linkColor
- 다큐먼트내 하이퍼링크의 색상을 설정하거나 반환합니다.
Document.vlinkColor
- 방문한 하이퍼링크의 색상을 설정하거나 반환합니다.
Document.width
- 현재 다큐먼트의 너비를 반환합니다.
Document.xmlEncoding
- XML 선언으로 결정된 인코딩을 반환합니다.
Document.xmlStandalone
안씀 Gecko 10.0- XML 선언이 다큐먼트를 독립되도록 지정하면
true
를(예, DTD 의 외부가 다큐먼트의 컨텐츠에 영향을 줌), 그렇지 않은 경우false
를 반환합니다. Document.xmlVersion
안씀 Gecko 10.0- XML 선언에 명시된 버전 넘버를 반환합니다. 선언에 명시되어 있지 않은 경우,
"1.0"
을 반환합니다.
메서드
Documet
는 Node
와 EventTarget
인터페이스도 상속합니다.
Document.adoptNode()
- 외부 문서로부터 노드를 가져옵니다.
Document.captureEvents()
Window.captureEvents
를 확인하세요.Document.caretRangeFromPoint()
- 지정한 좌표에 위치한 문서 프래그먼트에 대한
Range
객체를 반환합니다. Document.createAttribute()
- 새로운
Attr
객체를 생성하고 반환합니다. Document.createAttributeNS()
- 주어진 네임스페이스에 새로운 속성 노드를 생성하고 반환합니다.
Document.createCDATASection()
- 새로운 CDATA 노드를 생성하고 반환합니다.
Document.createComment()
- 새로운 주석 노드를 생성하고 반환합니다.
Document.createDocumentFragment()
- 새로운 문서 조각을 생성합니다.
Document.createElement()
- 주어진 태그명을 사용해 새로운 요소를 생성합니다.
Document.createElementNS()
- 주어진 태그명과 네임스페이스 URI를 갖는 새로운 요소를 생성합니다.
Document.createEntityReference()
- 새로운 개체 참조를 생성하고 반환합니다.
Document.createEvent()
- 이벤트 객체를 생성합니다.
Document.createNodeIterator()
NodeIterator
객체를 생성합니다.Document.createProcessingInstruction()
- 새로운
ProcessingInstruction
객체를 생성합니다. Document.createRange()
Range
객체를 생성합니다.Document.createTextNode()
- 텍스트 노드를 생성합니다.
Document.createTouch()
Touch
객체를 생성합니다.Document.createTouchList()
TouchList
객체를 생성합니다.Document.createTreeWalker()
TreeWalker
객체를 생성합니다.Document.enableStyleSheetsForSet()
- 지정한 스타일 시트 세트의 스타일 시트를 활성화합니다.
Document.exitPointerLock()
- 포인터 잠금을 해제합니다.
Document.getAnimations()
- 문서의 자손 요소를 대상으로 하고, 현재 실행 중인 모든
Animation
객체를 배열로 반환합니다. Document.getElementsByClassName()
- 주어진 클래스 이름을 갖는 요소의 목록을 반환합니다.
Document.getElementsByTagName()
- 주어진 태그명을 갖는 요소의 목록을 반환합니다.
Document.getElementsByTagNameNS()
- 주어진 태그명과 네임스페이스를 갖는 요소의 목록을 반환합니다.
Document.hasStorageAccess()
- 문서가 퍼스트파티first-party 저장소에 접근할 수 있는지 나타내는
Boolean
으로 이행하는Promise
를 반환합니다. Document.importNode()
- 외부 문서의 노드 복제본을 반환합니다.
Document.normalizeDocument()
- 개체 대체, 텍스트 노드 정규화 등의 작업을 실행합니다.
Document.releaseCapture()
- 문서의 요소에 현재 마우스 캡쳐가 있다면 이를 해제합니다.
Document.releaseEvents()
Window.releaseEvents()
를 확인하세요.Document.requestStorageAccess()
- 퍼스트파티first-party 저장소로의 접근이 가능한 경우 이행하고 불가능한 경우 거부하는
Promise
를 반환합니다. Document.routeEvent()
안씀 Gecko 24Window.routeEvent()
를 확인하세요.Document.mozSetImageElement()
- 지정한 요소 ID를 위한 배경 이미지로 사용되도록 요소 변경을 허용합니다.
Document
인터페이스는 ParentNode
인터페이스를 확장합니다.
document.getElementById()
- 주어진 ID를 가진 요소의 참조를 반환합니다.
document.querySelector()
- 문서 내에서 주어진 선택자를 만족하는 첫 번째
Element
를 반환합니다. document.querySelectorAll()
- 주어진 선택자를 만족하는 모든 요소의
NodeList
를 반환합니다.
Document
인터페이스는 XPathEvaluator
인터페이스를 확장합니다.
document.createExpression()
- 나중에 (여러 번) 평가할 수 있도록
XPathExpression
을 컴파일합니다. document.createNSResolver()
XPathNSResolver
객체를 생성합니다.document.evaluate()
- XPath 표현을 평가합니다.
HTML 문서의 확장
HTML 문서를 위한 Document
인터페이스는 HTML5 이전엔 HTMLDocument
인터페이스를 상속하고, 이후로는 확장합니다.
document.clear()
- 최근의 Firefox와 Internet Explorer를 포함하는 주요 최신 브라우저에서, 이 메소드는 아무것도 하지 않습니다.
document.close()
- 작성을 위한 문서 스트림을 닫습니다.
document.execCommand()
- 수정 가능한 문서에서 서식 명령을 실행합니다.
document.getElementsByName()
- 주어진 이름을 갖는 요소의 목록을 반환합니다.
document.hasFocus()
- 포커스가 지정한 문서 내 어느 곳이든 위치한 경우
true
를 반환합니다. document.open()
- 작성을 위한 문서 스트림을 엽니다.
document.queryCommandEnabled()
- 현재 범위에서 서식 명령을 실행할 수 있다면
true
를 반환합니다. document.queryCommandIndeterm()
- 현재 범위에서 서식 명령의 상태를 알 수 없으면
true
를 반환합니다. document.queryCommandState()
- 현재 범위에서 서식 명령을 실행했다면
true
를 반환합니다. document.queryCommandSupported()
- 현재 범위에서 서식 명령이 지원된다면
true
를 반환합니다. document.queryCommandValue()
- 현재 범위에서 서식 명령을 위한 현재 값을 반환합니다.
document.write()
- 문서에 텍스트를 작성합니다.
document.writeln()
- 문서에 텍스트 한 줄을 작성합니다.
DocumentOrShadowRoot로부터 포함된 메소드
Document
인터페이스는 DocumentOrShadowRoot
믹스인mixin이 정의하는 다음의 메서드를 포함합니다. 지금은 Chrome만 구현한 상태라는 점에 유의하세요. 다른 브라우저는 Document
인터페이스에 구현 중입니다.
DocumentOrShadowRoot.getSelection()
- 사용자에의해 선택된 텍스트의 범위 또는 캐럿의 현재 위치를 나타내는
Selection
객체를 반환합니다. DocumentOrShadowRoot.elementFromPoint()
- 지정한 위치에 있는 최상단 엘리먼트를 반환합니다.
DocumentOrShadowRoot.elementsFromPoint()
- 지정한 위치에 있는 모든 엘리먼트의 배열을 반환합니다.
DocumentOrShadowRoot.caretPositionFromPoint()
- 캐럿을 포함하는 DOM 노드와 그 노드내 캐첫의 문자 오프셋을 포함하는
CaretPosition
객체를 반환합니다.
비표준 확장
Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
Firefox 노트
Mozilla는 XUL 컨텐츠만을 위해 만들어진 비표준 속성의 집합을 정의합니다.
document.currentScript
- 현재 실행중인
<script>
엘리먼트를 반환합니다. document.documentURIObject
- (Mozilla 부가 기능 전용!) 다큐먼트의 URI 를 나타내는
nsIURI
객체를 반환합니다. 이 속성은 권한을 가진 자바스크립트 코드(UniversalXPConnect 권한을 갖는)에서만 특별한 의미를 갖습니다. document.popupNode
- 팝업이 불려진 노드를 반환합니다.
document.tooltipNode
- 현재 툴팁의 대상이되는 노드를 반환합니다.
Mozilla 는 또한 일부 비표준 메소드를 정의합니다.
document.execCommandShowHelp
안씀 Gecko 14.0- 이 메소드는 아무것도 하지 않았지만 항상 예외를 발생시켰으므로 Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11) 에서 제거되었습니다.
document.getBoxObjectFor
Element.getBoundingClientRect()
메소드를 대신 사용하세요.document.loadOverlay
- XUL 오버레이를 동적으로 로드합니다. XUL 다큐먼트에서만 동작합니다.
document.queryCommandText
안씀 Gecko 14.0- 이 메소드는 아무것도 하지 않았지만 예외를 발생시켰으므로 Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11) 에서 제거되었습니다.
Internet Explorer 노트
Microsoft는 일부 비표준 속성을 정의합니다.
document.fileSize
*- Returns size in bytes of the document. Starting with Internet Explorer 11, that property is no longer supported. See MSDN.
Internet Explorer는 Document
인터페이스내 Node
인터페이스의 모든 메소드를 지원하지 않습니다:
document.contains
- 대안으로
document.body.contains()
를 사용할 수 있습니다.
명세
브라우저 호환성
BCD tables only load in the browser