This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
* Some parts of this feature may have varying levels of support.
The Document interface represents any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree.
The DOM tree includes elements such as <body> and <table>, among many others. It provides functionality globally to the document, like how to obtain the page's URL and create new elements in the document.
The Document interface describes the common properties and methods for any kind of document. Depending on the document's type (e.g., HTML, XML, SVG, …), a larger API is available: HTML documents, served with the "text/html" content type, also implement the HTMLDocument interface, whereas XML and SVG documents implement the XMLDocument interface.
Document()Creates a new Document object.
This interface also inherits from the Node and EventTarget interfaces.
Document.activeElement Read only
Returns the Element that currently has focus.
Document.adoptedStyleSheetsAdd an array of constructed stylesheets to be used by the document. These stylesheets may also be shared with shadow DOM subtrees of the same document.
Document.bodyReturns the <body> or <frameset> node of the current document.
Document.characterSet Read only
Returns the character set being used by the document.
Document.childElementCount Read only
Returns the number of child elements of the current document.
Document.children Read only
Returns the child elements of the current document.
Document.compatMode Read only
Indicates whether the document is rendered in quirks or strict mode.
Document.contentType Read only
Returns the Content-Type from the MIME Header of the current document.
Document.currentScript Read only
Returns the <script> element whose script is currently being processed and isn't a JavaScript module.
Document.doctype Read only
Returns the Document Type Definition (DTD) of the current document.
Document.documentElement Read only
Returns the Element that is a direct child of the document. For HTML documents, this is normally the HTMLHtmlElement object representing the document's <html> element.
Document.documentURI Read only
Returns the document location as a string.
Document.embeds Read only
Returns an HTMLCollection of the embedded <embed> elements in the document.
Document.featurePolicy Experimental Read only
Returns the FeaturePolicy interface with the feature policies applied to the document.
Document.firstElementChild Read only
Returns the first child element of the current document.
Document.fontsReturns the FontFaceSet interface of the current document.
Document.forms Read only
Returns an HTMLCollection of the <form> elements in the document.
Document.fragmentDirective Read only
Returns the FragmentDirective for the current document.
Document.fullscreenElement Read only
The element that's currently in full screen mode for this document.
Document.head Read only
Returns the <head> element of the current document.
Returns a Boolean value indicating if the page is considered hidden or not.
Document.images Read only
Returns an HTMLCollection of the images in the document.
Document.implementation Read only
Returns the DOM implementation associated with the current document.
Document.lastElementChild Read only
Returns the last child element of the current document.
Document.links Read only
Returns an HTMLCollection of the hyperlinks in the document.
Document.pictureInPictureElement Read only
Returns the Element currently being presented in picture-in-picture mode in this document.
Document.pictureInPictureEnabled Read only
Returns true if the picture-in-picture feature is enabled.
Document.plugins Read only
Returns an HTMLCollection of the available plugins.
Document.pointerLockElement Read only
Returns the element set as the target for mouse events while the pointer is locked. null if lock is pending, pointer is unlocked, or if the target is in another document.
Document.prerendering Read only Experimental Non-standard
Returns a boolean that indicates whether the document is currently in the process of prerendering, as initiated via the Speculation Rules API.
Document.scripts Read only
Returns an HTMLCollection of the <script> elements in the document.
Document.scrollingElement Read only
Returns a reference to the Element that scrolls the document.
Document.styleSheets Read only
Returns a StyleSheetList of CSSStyleSheet objects for stylesheets explicitly linked into, or embedded in a document.
Document.timeline Read only
Returns timeline as a special instance of DocumentTimeline that is automatically created on page load.
Document.visibilityState Read only
Returns a string denoting the visibility state of the document. Possible values are visible, hidden, and unloaded.
The Document interface for HTML documents inherits from the HTMLDocument interface or is extended for such documents.
Returns a semicolon-separated list of the cookies for that document or sets a single cookie.
Document.defaultView Read only
Returns a reference to the window object.
Document.designModeGets/sets the ability to edit the whole document.
Document.dirGets/sets directionality (rtl/ltr) of the document.
Document.fullscreenEnabled Read only
Indicates whether fullscreen mode is available.
Document.lastModified Read only
Returns the date on which the document was last modified.
Document.location Read only
Returns the URI of the current document.
Document.readyState Read only
Returns loading status of the document.
Document.referrer Read only
Returns the URI of the page that linked to this page.
Document.titleSets or gets the title of the current document.
Document.URL Read only
Returns the document location as a string.
Some elements in the document are also exposed as properties:
<embed>, <form>, <iframe>, <img>, and <object> element, its name (if non-empty) is exposed. For example, if the document contains <form name="my_form">, then document["my_form"] (and its equivalent document.my_form) returns a reference to that element.<object> element, its id (if non-empty) is exposed.<img> element with non-empty name, its id (if non-empty) is exposed.If a property corresponds to a single element, that element is directly returned. If that single element is an iframe, then its contentWindow is returned instead. If the property corresponds to multiple elements, then an HTMLCollection is returned containing all of them.
Document.alinkColor Deprecated
Returns or sets the color of active links in the document body.
Document.all Deprecated
Provides access to all elements in the document — it returns an HTMLAllCollection rooted at the document node. This is a legacy, non-standard property and should not be used.
Document.anchors Deprecated Read only
Returns a list of all of the anchors in the document.
Document.applets Deprecated Read only
Returns an empty HTMLCollection. Legacy property that used to return the list of applets within a document.
Document.bgColor Deprecated
Gets/sets the background color of the current document.
Document.charset Deprecated Read only
Alias of Document.characterSet. Use this property instead.
Document.domain Deprecated
Gets/sets the domain of the current document.
Document.fgColor Deprecated
Gets/sets the foreground color, or text color, of the current document.
Document.fullscreen Deprecated
Returns true when the document is in fullscreen mode.
Document.inputEncoding Deprecated Read only
Alias of Document.characterSet. Use this property instead.
Document.lastStyleSheetSet Deprecated Read only Non-standard
Returns the name of the style sheet set that was last enabled. Has the value null until the style sheet is changed by setting the value of selectedStyleSheetSet.
Document.linkColor Deprecated
Gets/sets the color of hyperlinks in the document.
Document.preferredStyleSheetSet Deprecated Read only Non-standard
Returns the preferred style sheet set as specified by the page author.
Document.rootElement Deprecated
Like Document.documentElement, but only for <svg> root elements. Use this property instead.
Document.selectedStyleSheetSet Deprecated Non-standard
Returns which style sheet set is currently in use.
Document.styleSheetSets Deprecated Read only Non-standard
Returns a list of the style sheet sets available on the document.
Document.vlinkColor Deprecated
Gets/sets the color of visited hyperlinks.
Document.xmlEncoding Deprecated
Returns the encoding as determined by the XML declaration.
Document.xmlStandalone Deprecated Returns true if the XML declaration specifies the document to be standalone (e.g., An external part of the DTD affects the document's content), else false.
Document.xmlVersion Deprecated
Returns the version number as specified in the XML declaration or "1.0" if the declaration is absent.
This interface also inherits from the Node and EventTarget interfaces.
Document.adoptNode()Adopt node from an external document.
Document.append()Inserts a set of Node objects or strings after the last child of the document.
Document.browsingTopics() Experimental Non-standard
Returns a promise that fulfills with an array of objects representing the top topics for the user, one from each of the last three epochs. By default, the method also causes the browser to record the current page visit as observed by the caller, so the page's hostname can later be used in topics calculation. See the Topics API for more details.
Document.captureEvents() Deprecated See Window.captureEvents.
Document.caretPositionFromPoint()Returns a CaretPosition object containing the DOM node containing the caret, and caret's character offset within that node.
Document.caretRangeFromPoint() Non-standard
Gets a Range object for the document fragment under the specified coordinates.
Document.createAttribute()Creates a new Attr object and returns it.
Document.createAttributeNS()Creates a new attribute node in a given namespace and returns it.
Document.createCDATASection()Creates a new CDATA node and returns it.
Document.createComment()Creates a new comment node and returns it.
Document.createDocumentFragment()Creates a new document fragment.
Document.createElement()Creates a new element with the given tag name.
Document.createElementNS()Creates a new element with the given tag name and namespace URI.
Document.createEvent() Deprecated
Creates an event object.
Document.createNodeIterator()Creates a NodeIterator object.
Document.createProcessingInstruction()Creates a new ProcessingInstruction object.
Document.createRange()Creates a Range object.
Document.createTextNode()Creates a text node.
Document.createTouch() Deprecated Non-standard
Creates a Touch object.
Document.createTouchList() Deprecated Non-standard
Creates a TouchList object.
Document.createTreeWalker()Creates a TreeWalker object.
Document.elementFromPoint()Returns the topmost element at the specified coordinates.
Document.elementsFromPoint()Returns an array of all elements at the specified coordinates.
Document.enableStyleSheetsForSet() Deprecated Non-standard
Enables the style sheets for the specified style sheet set.
Document.exitFullscreen()Stops document's fullscreen element from being displayed fullscreen.
Document.exitPictureInPicture()Remove the video from the floating picture-in-picture window back to its original container.
Document.exitPointerLock()Release the pointer lock.
Document.getAnimations()Returns an array of all Animation objects currently in effect, whose target elements are descendants of the document.
Document.getBoxQuads() Experimental Returns a list of DOMQuad objects representing the CSS fragments of the node.
Document.getElementById()Returns an object reference to the identified element.
Document.getElementsByClassName()Returns a list of elements with the given class name.
Document.getElementsByTagName()Returns a list of elements with the given tag name.
Document.getElementsByTagNameNS()Returns a list of elements with the given tag name and namespace.
Document.getSelection()Returns a Selection object representing the range of text selected by the user, or the current position of the caret.
Document.hasStorageAccess()Returns a Promise that resolves with a boolean value indicating whether the document has access to unpartitioned cookies.
New name for Document.hasStorageAccess().
Document.importNode()Returns a clone of a node from an external document.
Document.moveBefore() Experimental
Moves a given Node inside the Document DOM node as a direct child, before a given reference node, without removing and then inserting the node.
Document.mozSetImageElement() Non-standard
Allows you to change the element being used as the background image for a specified element ID.
Document.prepend()Inserts a set of Node objects or strings before the first child of the document.
Document.querySelector()Returns the first Element node within the document, in document order, that matches the specified selectors.
Document.querySelectorAll()Returns a list of all the Element nodes within the document that match the specified selectors.
Document.releaseCapture() Non-standard
Releases the current mouse capture if it's on an element in this document.
Document.releaseEvents() Deprecated Document.replaceChildren()Replaces the existing children of a document with a specified new set of children.
Document.requestStorageAccess()Allows a document loaded in a third-party context (i.e., embedded in an <iframe>) to request access to unpartitioned cookies, in cases where user agents by default block access to unpartitioned cookies by sites loaded in a third-party context to improve privacy.
Document.requestStorageAccessFor() Experimental
Allows top-level sites to request third-party cookie access on behalf of embedded content originating from another site in the same related website set.
Document.startViewTransition()Starts a new view transition and returns a ViewTransition object to represent it.
The Document interface is extended with the XPathEvaluator interface:
Document.createExpression()Compiles an XPathExpression which can then be used for (repeated) evaluations.
Document.createNSResolver() Deprecated
Returns the input node as-is.
Document.evaluate()Evaluates an XPath expression.
The Document interface for HTML documents inherit from the HTMLDocument interface or is extended for such documents:
Document.clear() Deprecated
This method does nothing.
Document.close()Closes a document stream for writing.
Document.execCommand() Deprecated
On an editable document, executes a formatting command.
Document.getElementsByName()Returns a list of elements with the given name.
Document.hasFocus()Returns true if the focus is currently located anywhere inside the specified document.
Document.open()Opens a document stream for writing.
Document.queryCommandEnabled() Deprecated Non-standard
Returns true if the formatting command can be executed on the current range.
Document.queryCommandIndeterm() Deprecated Returns true if the formatting command is in an indeterminate state on the current range.
Document.queryCommandState() Deprecated Non-standard
Returns true if the formatting command has been executed on the current range.
Document.queryCommandSupported() Deprecated Non-standard
Returns true if the formatting command is supported on the current range.
Document.queryCommandValue() Deprecated Returns the current value of the current range for a formatting command.
Document.write() Deprecated
Writes text in a document.
Document.writeln() Deprecated
Writes a line of text in a document.
This interface also inherits from the Node and EventTarget interfaces.
Document.parseHTML()Creates a new Document object from a string of HTML in an XSS-safe manner with sanitization.
Document.parseHTMLUnsafe()Creates a new Document object from a string of HTML without performing sanitization. The string may contain declarative shadow roots.
Listen to these events using addEventListener() or by assigning an event listener to the oneventname property of this interface. In addition to the events listed below, many events can bubble from nodes contained in the document tree.
afterscriptexecute Non-standard Deprecated
Fired when a static <script> element finishes executing its script
beforescriptexecute Non-standard Deprecated
Fired when a static <script> is about to start executing.
prerenderingchange Experimental
Fired on a prerendered document when it is activated (i.e., the user views the page).
securitypolicyviolationFired when a content security policy is violated.
visibilitychangeFired when the content of a tab has become visible or has been hidden.
fullscreenchangeFired when the Document transitions into or out of fullscreen mode.
fullscreenerrorFired if an error occurs while attempting to switch into or out of fullscreen mode.
DOMContentLoadedFired when the document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading.
readystatechangeFired when the readyState attribute of a document has changed.
pointerlockchangeFired when the pointer is locked/unlocked.
pointerlockerrorFired when locking the pointer failed.
scrollFired when the document view or an element has been scrolled.
scrollendFired when the document view or an element has completed scrolling.
scrollsnapchange Experimental
Fired on the scroll container at the end of a scrolling operation when a new scroll snap target has been selected.
scrollsnapchanging Experimental
Fired on the scroll container when the browser determines a new scroll snap target is pending, i.e., it will be selected when the current scroll gesture ends.
selectionchangeFired when the current text selection on a document is changed.
Not all events that bubble can reach the Document object. Only the following do and can be listened for on the Document object:
abortauxclickbeforeinputbeforematchbeforetoggleblurcancelcanplaycanplaythroughchangeclickclosecontextlostcontextmenucontextrestoredcopycuechangecutdblclickdragdragenddragenterdragleavedragoverdragstartdropdurationchangeemptiedendederrorfocusformdatainputinvalidkeydownkeypresskeyuploadloadeddataloadedmetadataloadstartmousedownmouseentermouseleavemousemovemouseoutmouseovermouseuppastepauseplayplayingprogressratechangeresetresizescrollscrollendsecuritypolicyviolationseekedseekingselectslotchangestalledsubmitsuspendtimeupdatetogglevolumechangewaitingwheel| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
DOMContentLoaded_event |
1 | 12 | 1 | 9 | 3.1 | 18 | 4 | 10.1 | 2 | 1.0 | 4.4 | 2 |
Document |
60 | 17 | 20 | 47 | 8 | 60 | 20 | 44 | 8 | 8.0 | 60 | 8 |
URL |
1 | 12 | 19 | 3 | 3 | 18 | 19 | 10.1 | 2 | 1.0 | 4.4 | 2 |
Document |
1 | 12 | 1 | 3 | 1 | 18 | 4 | 10.1 | 1 | 1.0 | 1 | 1 |
activeElement |
2 | 12 | 3 | ≤12.1 | 7 | 18 | 4 | ≤12.1 | 7 | 1.0 | 4.4 | 7 |
adoptNode |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
adoptedStyleSheets |
73 | 79 | 101 | 60 | 16.4 | 73 | 101 | 50 | 16.4 | 11.0 | 73 | 16.4 |
afterscriptexecute_event |
No | No | 9 | No | No | No | 9 | No | No | No | No | No |
alinkColor |
64 | 12 | 69 | 51 | 11 | 64 | 79 | 47 | 11 | 9.0 | 64 | 11 |
all |
64 | 12 | 70 | 51 | 11 | 64 | 79 | 47 | 11 | 9.0 | 64 | 11 |
anchors |
1 | 12 | 61 | ≤12.1 | 4 | 18 | 61 | ≤12.1 | 3.2 | 1.0 | 4.4 | 3.2 |
append |
54 | 17 | 49 | 41 | 10 | 54 | 49 | 41 | 10 | 6.0 | 54 | 10 |
applets |
1 | 12 | 61 | ≤12.1 | 4 | 18 | 61 | ≤12.1 | 3.2 | 1.0 | 4.4 | 3.2 |
ariaNotify |
141["Fully supported on Windows only.", "Method exposed on macOS, but notifications are not reliably spoken."] |
141["Fully supported on Windows only.", "Method exposed on macOS, but notifications are not reliably spoken."] |
No | No | No | 141["Fully supported on Windows only.", "Method exposed on macOS, but notifications are not reliably spoken."] |
No | No | No | No | 141["Fully supported on Windows only.", "Method exposed on macOS, but notifications are not reliably spoken."] |
No |
beforescriptexecute_event |
No | No | 9 | No | No | No | 9 | No | No | No | No | No |
bgColor |
64 | 12 | 69 | 51 | 11 | 64 | 79 | 47 | 11 | 9.0 | 64 | 11 |
body |
1 | 12 | 60 | 9.6 | 1 | 18 | 60 | 10.1 | 1 | 1.0 | 4.4 | 1 |
browsingTopics |
126 | 126 | No | 112 | No | 126 | No | 83 | No | 28.0 | 126 | No |
captureEvents |
64 | 12 | 70 | 51 | 11 | 64 | 79 | 47 | 11 | 9.0 | 64 | 11 |
caretPositionFromPoint |
128 | 128 | 20 | 114 | No | 128 | 20 | 85 | No | 28.0 | 128 | No |
caretRangeFromPoint |
4 | 12 | No | 15 | 5 | 18 | No | 14 | 4 | 1.0 | 4.4 | 4 |
characterSet |
11charset alias was made read-only in Chrome 45. |
121212 | 1441.5 | ≤12.115charset alias was made read-only in Opera 45. |
333 | 1818charset alias was made read-only in Chrome Android 45. |
4444 | ≤12.114charset alias was made read-only in Opera 45. |
111 | 1.01.0charset alias was made read-only in Samsung Internet 5.0. |
11charset alias was made read-only in WebView 45. |
111 |
childElementCount |
29 | 17 | 25 | 16 | 9 | 29 | 25 | 16 | 9 | 2.0 | 4.4 | 9 |
children |
29 | 16 | 25 | 16 | 9 | 29 | 25 | 16 | 9 | 2.0 | 4.4 | 9 |
clear |
64 | 12 | 70 | 51 | 11 | 64 | 79 | 47 | 11 | 9.0 | 64 | 11 |
close |
45 | 12 | 69 | 51 | 11 | 45 | 79 | 47 | 11 | 5.0 | 45 | 11 |
compatMode |
8 | 12 | 19 | ≤12.1 | 5.1 | 18 | 19 | ≤12.1 | 5 | 1.0 | 4.4 | 5 |
contentType |
36 | 17 | 1 | 23≤12.1–15 | 9 | 36 | 4 | 24≤12.1–14 | 9 | 3.0 | 37 | 9 |
cookie |
1 | 12 | 68 | 3 | 4 | 18 | 68 | 10.1 | 3.2 | 1.0 | 4.4 | 3.2 |
createAttribute |
1 | 12 | 441–44The parameter was not converted to its lowercase variant. |
≤12.1 | 1 | 18 | 444–44The parameter was not converted to its lowercase variant. |
≤12.1 | 1 | 1.0 | 4.4 | 1 |
createAttributeNS |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
createCDATASection |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
createComment |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
createDocumentFragment |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
createElement |
1 | 12 | 1Doesn't conform to the DOM spec for XUL and XHTML documents:localName and namespaceURI are not set to null on the created element. |
6 | 1 | 18 | 4 | 10.1 | 1 | 1.0 | 4.4 | 1 |
createElementNS |
1 | 12 | 1Doesn't conform to the DOM spec for XUL and XHTML documents:localName and namespaceURI are not set to null on the created element. |
≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
createEvent |
1 | 12 | 1From version 67, creating touch events using this method is no longer supported. |
7 | 1 | 18 | 4 | 10.1 | 1 | 1.0 | 4.4 | 1 |
createExpression |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 3 | 1 |
createNSResolver |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 3 | 1 |
createNodeIterator |
1 | 12 | 1 | 9 | 3 | 18 | 4 | 10.1 | 1 | 1.0 | 4.4 | 1 |
createProcessingInstruction |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
createRange |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
createTextNode |
1 | 12 | 1 | 7 | 1 | 18 | 4 | 10.1 | 1 | 1.0 | 4.4 | 1 |
createTouch |
No | No | 18–67 | No | No | 25–68Since Chrome 55, all parameters are optional. |
6 | 14–48Since Opera Android 42, all parameters are optional. |
≤3 | 1.5–10.0Since Chrome 55, all parameters are optional. |
4.4–68Since Chrome 55, all parameters are optional. |
≤3 |
createTouchList |
22–69 | No | 18–67 | 15–56 | No | 25–69 | 6 | 14–48 | ≤3 | 1.5–10.0 | 4.4–69 | ≤3 |
createTreeWalker |
1 | 12 | 1 | 9 | 3 | 18 | 4 | 10.1 | 3 | 1.0 | 4.4 | 3 |
currentScript |
29 | 12 | 4 | 16 | 8 | 29 | 4 | 16 | 8 | 2.0 | 4.4 | 8 |
customElementRegistry |
No | No | No | No | 26 | No | No | No | 26 | No | No | 26 |
defaultView |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
designMode |
36 | 12 | 69 | 9 | 10.1 | 36 | 79 | 10.1 | 10.3 | 3.0 | 37 | 10.3 |
dir |
36 | 12 | 1Incorrect behavior before Firefox 23. |
51 | 10.1 | 36 | 4Incorrect behavior before Firefox for Android 23. |
47 | 10.3 | 3.0 | 37 | 10.3 |
doctype |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
documentElement |
1 | 12 | 1 | 7 | 1 | 18 | 4 | 10.1 | 1 | 1.0 | 4.4 | 1 |
documentURI |
1 | 17 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
domain |
1Since Chrome 115, settingdomain has no effect, unless the website has opted into origin-keyed agent clusters. |
12 |
69From Firefox 62, if the domain cannot be identified,domain returns an empty string instead of null. See bug 819475. |
≤12.1 | 1 | 18Since Chrome Android 115, settingdomain has no effect, unless the website has opted into origin-keyed agent clusters. |
79From Firefox for Android 62, if the domain cannot be identified,domain returns an empty string instead of null. See bug 819475. |
≤12.1 | 1 | 1.0Since Samsung Internet 23.0, settingdomain has no effect, unless the website has opted into origin-keyed agent clusters. |
4.4Since WebView Android 115, settingdomain has no effect, unless the website has opted into origin-keyed agent clusters. |
1 |
elementFromPoint |
1Before Chrome 66, this method returnednull when the element was a child of a host node. See bug 40537452. |
12 | 3 | ≤12.1Before Opera 53, this method returnednull when the element was a child of a host node. See bug 40537452. |
4 | 18Before Chrome Android 66, this method returnednull when the element was a child of a host node. See bug 40537452. |
4 | ≤12.1Before Opera Android 47, this method returnednull when the element was a child of a host node. See bug 40537452. |
3.2 | 1.0Before Samsung Internet 9.0, this method returnednull when the element was a child of a host node. See bug 40537452. |
4.4Before WebView Android 66, this method returnednull when the element was a child of a host node. See bug 40537452. |
3.2 |
elementsFromPoint |
43Before Chrome 66, this method returnednull when the element was a child of a host node. See bug 40537452. |
7912–79Returns aNodeList instead of an array. See the MSDN documentation. Returns null when the point provided has no elements beneath it (e.g., when given a point outside the document). |
46 | 30 | 11.1 | 43Before Chrome Android 66, this method returnednull when the element was a child of a host node. See bug 40537452. |
46 | 30 | 11.3 | 4.0Before Samsung Internet 9.0, this method returnednull when the element was a child of a host node. See bug 40537452. |
43Before WebView Android 66, this method returnednull when the element was a child of a host node. See bug 40537452. |
11.3 |
embeds |
36 | 12 | 61 | 51 | 10.1 | 36 | 61 | 47 | 10.3 | 3.0 | 37 | 10.3 |
enableStyleSheetsForSet |
No | No | 3 | No | No | No | 4 | No | No | No | No | No |
evaluate |
1 | 12 | 1 | 9 | 3 | 18 | 4 | 10.1 | 1 | 1.0 | 3 | 1 |
execCommand |
1 | 12 |
69["From Firefox 82, nested calls are not supported (returnfalse). See bug 1634262.", "Before Firefox 89, manipulating the content of <input> and <textarea> elements using Document.execCommand() commands requires workarounds (see bug 1220696)."] |
9 | 1.3 | 18 |
79["From Firefox for Android 82, nested calls are not supported (returnfalse). See bug 1634262.", "Before Firefox for Android 89, manipulating the content of <input> and <textarea> elements using Document.execCommand() commands requires workarounds (see bug 1220696)."] |
10.1 | 1 | 1.0 | 4.4 | 1 |
exitFullscreen |
7115 | 791212–14 | 649 | 581512.1–15 | 16.45.1 | 7118 | 649 | 501412.1–14 |
16.4["Only available on iPad, not on iPhone.", "Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games."]12Only available on iPad, not on iPhone. |
10.01.0 | 714.4 | No |
exitPictureInPicture |
69 | 79 | No | 56 | 13.1 | 105 | No | 72 | 13.4 | 20.0 | No | 13.4 |
exitPointerLock |
3722 | 13 | 5014–50 | 2415 | 10.1 | No | 5014–50 | No | No | No | No | No |
featurePolicy |
74 | 79 | 69 | 62 | No | 74 | No | 53 | No | 11.0 | 74 | No |
fgColor |
64 | 12 | 69 | 51 | 11 | 64 | 79 | 47 | 11 | 9.0 | 64 | 11 |
firstElementChild |
29 | 17 | 25 | 16 | 9 | 29 | 25 | 16 | 9 | 2.0 | 4.4 | 9 |
fonts |
35 | 79 | 41 | 22 | 10 | 35 | 41 | 22 | 10 | 3.0 | 37 | 10 |
forms |
1 | 12 | 61 | ≤12.1 | 4 | 18 | 61 | ≤12.1 | 3.2 | 1.0 | 4.4 | 3.2 |
fragmentDirective |
86 | 86 | 131 | 72 | 18.4 | 86 | 131 | 61 | 18.4 | 14.0 | 86 | 18.4 |
freeze_event |
68 | 79 | No | 55 | No | 68 | No | 48 | No | 10.0 | 68 | No |
fullscreen |
7115 | 7912 | 649 | 5815 | 16.46 | 7118 | 649 | 5014 |
16.4["Only available on iPad, not on iPhone.", "Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games."]12Only available on iPad, not on iPhone. |
10.01.0 | 714.4 | No |
fullscreenElement |
7120 | 791212–14 | 649 | 581512.1–15 | 16.46 | 7125 | 649 | 501412.1–14 |
16.4["Only available on iPad, not on iPhone.", "Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games."]12Only available on iPad, not on iPhone. |
10.01.5 | 714.4 |
16.4["Only available on iPad, not on iPhone.", "Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games."]12Only available on iPad, not on iPhone. |
fullscreenEnabled |
7120 | 12 | 6410 | 581512.1–15 | 16.46 | 7125 | 6410 | 501412.1–14 |
16.4["Only available on iPad, not on iPhone.", "Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games."]12Only available on iPad, not on iPhone. |
10.01.5 | 714.4 | No |
fullscreenchange_event |
7115 | 791212–14 | 6410 | 581512.1–15 | 16.45.1 | 7118 | 6410 | 501412.1–14 |
16.4["Only available on iPad, not on iPhone.", "Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games."]12Only available on iPad, not on iPhone. |
10.01.0 | 714.4 | No |
fullscreenerror_event |
7118 | 791212–14 | 6410 | 581512.1–15 | 16.46 | 7118 | 6410 | 501412.1–14 |
16.4["Only available on iPad, not on iPhone.", "Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games."]12Only available on iPad, not on iPhone. |
10.01.0 | 714.4 | No |
getAnimations |
84 | 84 | 75 | 70 | 1413.1–14Implements an older version of the specification, see bug 179536. |
84 | 79 | 60 | 1413.4–14Implements an older version of the specification, see bug 179536. |
14.0 | 84 | 1413.4–14Implements an older version of the specification, see bug 179536. |
getBoxQuads |
No | No | 31 | No | No | No | No | No | No | No | No | No |
getElementById |
1 | 12 | 1 | 7 | 1 | 18 | 4 | 10.1 | 1 | 1.0 | 4.4 | 1 |
getElementsByClassName |
1 | 12 | 3 | 9.5 | 3.1 | 18 | 4 | 10.1 | 2 | 1.0 | 4.4 | 2 |
getElementsByName |
1 | 12Before Edge 79, this method returns anHTMLCollection, not a NodeList. |
58 | 5 | 4 | 18 | 58 | 10.1 | 3.2 | 1.0 | 4.4 | 3.2 |
getElementsByTagName |
1 | 12 | 1 | 5.1 | 1 | 18 | 4 | 10.1 | 1 | 1.0 | 4.4 | 1 |
getElementsByTagNameNS |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
getSelection |
2 | 12 | 57 | ≤12.1 | 4 | 18 | 57 | ≤12.1 | 3.2 | 1.0 | 4.4 | 3.2 |
hasFocus |
34 | 12 | 3 | 21 | 7 | 34 | 4 | 21 | 7 | 2.0 | 37 | 7 |
hasPrivateToken |
117 | 117 | No | 103 | No | 117 | No | 78 | No | 24.0 | 117 | No |
hasRedemptionRecord |
117 | 117 | No | 103 | No | 117 | No | 78 | No | 24.0 | 117 | No |
hasStorageAccess |
119 | 85 | 65 | 105 | 11.1 | 120 | 65 | 80 | 11.3 | 25.0 | 120 | 11.3 |
hasUnpartitionedCookieAccess |
125 | 125 | No | 111 | No | 125 | No | 83 | No | 27.0 | 125 | No |
head |
4 | 12 | 61 | 11 | 5 | 18 | 61 | 11 | 4 | 1.0 | 4.4 | 4 |
hidden |
3313 | 12 |
18Since Firefox 56 it also returnstrue on macOS when the window is completely hidden by another non-translucent application. |
12.1 | 7 | 3318 |
18Since Firefox for Android 56 it also returnstrue on macOS when the window is completely hidden by another non-translucent application. |
12.1 | 7 | 2.01.0 | 4.4.34.4 | 7 |
images |
1 | 12 | 61 | ≤12.1 | 4 | 18 | 61 | ≤12.1 | 3.2 | 1.0 | 4.4 | 3.2 |
implementation |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
importNode |
1 | 12 | 1 | 9 | 1 | 18 | 4 | 10.1 | 1 | 1.0 | 4.4 | 1 |
lastElementChild |
29 | 17 | 25 | 16 | 9 | 29 | 25 | 16 | 9 | 2.0 | 4.4 | 9 |
lastModified |
1 | 12 | 1 | ≤12.1 | 4 | 18 | 4 | ≤12.1 | 3.2 | 1.0 | 4.4 | 3.2 |
lastStyleSheetSet |
No | No | 3 | No | No | No | 4 | No | No | No | No | No |
linkColor |
64 | 12 | 69 | 51 | 11 | 64 | 79 | 47 | 11 | 9.0 | 64 | 11 |
links |
1 | 12 | 61 | ≤12.1 | 4 | 18 | 61 | ≤12.1 | 3.2 | 1.0 | 4.4 | 3.2 |
location |
1 | 12 | 1 | 3 | 4 | 18 | 4 | 10.1 | 3.2 | 1.0 | 4.4 | 3.2 |
moveBefore |
133 | 133 | No | 118 | No | 133 | No | 88 | No | No | 133 | No |
mozSetImageElement |
No | No | 4 | No | No | No | 4 | No | No | No | No | No |
open |
45 | 12 | 69 | 51 | 11 | 45 | 79 | 47 | 11 | 5.0 | 45 | 11 |
parseHTMLUnsafe_static |
124 | 124 | 128 | 110 | 2617.4–26If there are custom elements in a declarative shadow root in the parsed HTML, then the elements' constructors andconnectedCallback() methods are not called (bug 296420). |
124 | 128 | 82 | 2617.4–26If there are custom elements in a declarative shadow root in the parsed HTML, then the elements' constructors andconnectedCallback() methods are not called (bug 296420). |
27.0 | 124 | 2617.4–26If there are custom elements in a declarative shadow root in the parsed HTML, then the elements' constructors andconnectedCallback() methods are not called (bug 296420). |
parseHTML_static |
No | No | 139 | No | No | No | No | No | No | No | No | No |
pictureInPictureElement |
69 | 79 | No | 56 | 13.1 | 105 | No | 72 | 13.4 | 20.0 | No | 13.4 |
pictureInPictureEnabled |
69 | 79 | No | 56 | 13.1 | 105 | No | 72 | 13.4 | 20.0 | No | 13.4 |
plugins |
36 | 12 | 61 | 51 | 10.1 | 36 | 61 | 47 | 10.3 | 3.0 | 37 | 10.3 |
pointerLockElement |
37 | 13 | 5014–50 | 24 | 10.1 | No | 5014–50 | No | No | No | No | No |
pointerlockchange_event |
3622–38 | 13 | 5014–50 | 2315–25 | 10.1 | No | 5014–50 | No | No | No | No | No |
pointerlockerror_event |
3622–38 | 13 | 5014–50 | 2315–25 | 10.1 | No | 5014–50 | No | No | No | No | No |
preferredStyleSheetSet |
No | No | 3 | No | No | No | 4 | No | No | No | No | No |
prepend |
54 | 17 | 49 | 41 | 10 | 54 | 49 | 41 | 10 | 6.0 | 54 | 10 |
prerendering |
108 | 108 | No | 94 | No | 108 | No | 73 | No | 21.0 | 108 | No |
prerenderingchange_event |
108 | 108 | No | 94 | No | 108 | No | 73 | No | 21.0 | 108 | No |
queryCommandEnabled |
1 | 12 | 691–41["Only supported forHTMLDocument, not all Document objects.", "queryCommandEnabled with arguments cut, copy or paste would throw errors unless the script had special privileges."] |
≤12.1 | 2 | 18 | 794–41["Only supported forHTMLDocument, not all Document objects.", "queryCommandEnabled with arguments cut, copy or paste would throw errors unless the script had special privileges."] |
≤12.1 | 1 | 1.0 | 4.4 | 1 |
queryCommandIndeterm |
1 | 12 | 69 | 15 | 2 | 18 | 79 | 14 | 1 | 1.0 | 4.4 | 1 |
queryCommandState |
1 | 12 | 69 | ≤12.1 | 2 | 18 | 79 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
queryCommandSupported |
1 | 12 | 691–41["Only supported forHTMLDocument, not all Document objects.", "The \"paste\" command is reported as supported when the paste feature is available even if the calling script has insufficient privileges to actually perform the action."] |
≤12.1 | 2 | 18 | 794–41["Only supported forHTMLDocument, not all Document objects.", "The \"paste\" command is reported as supported when the paste feature is available even if the calling script has insufficient privileges to actually perform the action."] |
≤12.1 | 1 | 1.0 | 4.4 | 1 |
queryCommandValue |
1 | 12 | 69 | ≤12.1 | 2 | 18 | 79 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
querySelector |
1 | 12 | 3.5 | 10 | 3.1 | 18 | 4 | 10.1 | 2 | 1.0 | 4.4 | 2 |
querySelectorAll |
1 | 12 | 3.5 | 10 | 3.1 | 18 | 4 | 10.1 | 2 | 1.0 | 4.4 | 2 |
readyState |
1 | 12 | 3.6 | 11Opera Presto fires 'complete' late after the 'load' event (in an incorrect order as per HTML5 standard specification). |
1 | 18 | 4 | 11Opera Presto fires 'complete' late after the 'load' event (in an incorrect order as per HTML5 standard specification). |
1 | 1.0 | 4.4 | 1 |
readystatechange_event |
9 | 12 | 4 | ≤12.1 | 5.1 | 18 | 4 | ≤12.1 | 5 | 1.0 | 4.4 | 5 |
referrer |
1 | 12 | 1 | 3 | 1 | 18 | 4 | 10.1 | 1 | 1.0 | 4.4 | 1 |
releaseCapture |
No | No | 4 | No | No | No | 4 | No | No | No | No | No |
releaseEvents |
64 | 12 | 70 | 51 | 11 | 64 | 79 | 47 | 11 | 9.0 | 64 | 11 |
replaceChildren |
86 | 86 | 78 | 72 | 14 | 86 | 79 | 61 | 14 | 14.0 | 86 | 14 |
requestStorageAccess |
119 | 85 | 65 | 105 | 11.1Client-side storage access granted per-page (see explanation) |
120 | 65 | 80 | 11.3Client-side storage access granted per-page (see explanation) |
25.0 | No | 11.3Client-side storage access granted per-page (see explanation) |
requestStorageAccessFor |
119Requires the calling top-level page and the embedded document (that the storage access is being requested for) to be part of the same related website set. |
119Requires the calling top-level page and the embedded document (that the storage access is being requested for) to be part of the same related website set. |
No | 105Requires the calling top-level page and the embedded document (that the storage access is being requested for) to be part of the same related website set. |
No | 119Requires the calling top-level page and the embedded document (that the storage access is being requested for) to be part of the same related website set. |
No | 79Requires the calling top-level page and the embedded document (that the storage access is being requested for) to be part of the same related website set. |
No | 25.0Requires the calling top-level page and the embedded document (that the storage access is being requested for) to be part of the same related website set. |
No | No |
resume_event |
68 | 79 | No | 55 | No | 68 | No | 48 | No | 10.0 | 68 | No |
rootElement |
34 | 12 | 52 | 21 | 10.1 | 34 | 52 | 21 | 10.3 | 2.0 | 37 | 10.3 |
scripts |
36 | 12 | 61 | ≤12.1 | 10.1 | 36 | 61 | ≤12.1 | 10.3 | 3.0 | 37 | 10.3 |
scroll_event |
1 | 12 | 6 | 11.6 | 2 | 18 | 6 | 12 | 1 | 1.0 | 4.4 | 1 |
scrollend_event |
114 | 114 | 109 | 100 | No | 114 | 109 | 76 | No | 23.0 | 114 | No |
scrollingElement |
44 | 12 | 48 | 31 | 9 | 44 | 48 | 32 | 9 | 4.0 | 44 | 9 |
scrollsnapchange_event |
129 | 129 | No | 115 | No | 129 | No | 86 | No | 28.0 | 129 | No |
scrollsnapchanging_event |
129 | 129 | No | 115 | No | 129 | No | 86 | No | 28.0 | 129 | No |
securitypolicyviolation_event |
76 | 79 | 93 | 63 | 15.4 | 76 | 93 | 54 | 15.4 | 12.0 | 76 | 15.4 |
selectedStyleSheetSet |
No | No | 3 | No | No | No | 4 | No | No | No | No | No |
selectionchange_event |
11 | 12 | 52 | 15 | 5.1 | 18 | 52 | 14 | 5 | 1.0 | 4.4 | 5 |
startViewTransition |
111 | 111 | preview140 | 97 | 18 | 111 | No | 75 | 18 | 22.0 | 111 | 18 |
styleSheetSets |
No | No | 3 | No | No | No | 4 | No | No | No | No | No |
styleSheets |
1 | 12 | 1 | ≤12.1 | 4 | 18 | 4 | ≤12.1 | 3.2 | 1.0 | 4.4 | 3.2 |
timeline |
84 | 84 | 75 | 70 | 13.1 | 84 | 79 | 60 | 13.4 | 14.0 | 84 | 13.4 |
title |
1 | 12 | 1 | ≤12.1 | 4 | 18 | 4 | ≤12.1 | 3.2 | 1.0 | 4.4 | 3.2 |
visibilityState |
3313 | 12 | 1810–52 | 201512.1–15 | 7 | 3318 | 1810–52 | 201412.1–14 | 7 | 2.01.0 | 4.4.34.4 | 7 |
visibilitychange_event |
6213Theonvisibilitychange event handler property is not supported.33–62Theonvisibilitychange event handler property is not supported. |
1812–18Theonvisibilitychange event handler property is not supported. |
56 | 4915Theonvisibilitychange event handler property is not supported.20–49Theonvisibilitychange event handler property is not supported.12.1–15Theonvisibilitychange event handler property is not supported. |
14.114–14.1Doesn't fire thevisibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See bug 116769, bug 151234, bug 151610, and bug 194897.10.1–14["Doesn't fire thevisibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See bug 116769, bug 151234, bug 151610, and bug 194897.", "Before Safari 14, the event does not bubble, so document.addEventListener('visibilitychange', ...) works, but window.addEventListener('visibilitychange', ...) does not."]7–10.1["Doesn't fire thevisibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See bug 116769, bug 151234, bug 151610, and bug 194897.", "Before Safari 14, the event does not bubble, so document.addEventListener('visibilitychange', ...) works, but window.addEventListener('visibilitychange', ...) does not.", "The onvisibilitychange event handler property is not supported."] |
6218Theonvisibilitychange event handler property is not supported.33–62Theonvisibilitychange event handler property is not supported. |
56 | 4614Theonvisibilitychange event handler property is not supported.20–46Theonvisibilitychange event handler property is not supported.12.1–14Theonvisibilitychange event handler property is not supported. |
14.514–14.5Doesn't fire thevisibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See bug 116769, bug 151234, bug 151610, and bug 194897.10.3–14["Doesn't fire thevisibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See bug 116769, bug 151234, bug 151610, and bug 194897.", "Before Safari on iOS 14, the event does not bubble, so document.addEventListener('visibilitychange', ...) works, but window.addEventListener('visibilitychange', ...) does not."]7–10.3["Doesn't fire thevisibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See bug 116769, bug 151234, bug 151610, and bug 194897.", "Before Safari on iOS 14, the event does not bubble, so document.addEventListener('visibilitychange', ...) works, but window.addEventListener('visibilitychange', ...) does not.", "The onvisibilitychange event handler property is not supported."] |
8.01.0Theonvisibilitychange event handler property is not supported.2.0–8.0Theonvisibilitychange event handler property is not supported. |
624.4Theonvisibilitychange event handler property is not supported.4.4.3–62Theonvisibilitychange event handler property is not supported. |
14.514–14.5Doesn't fire thevisibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See bug 116769, bug 151234, bug 151610, and bug 194897.10.3–14["Doesn't fire thevisibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See bug 116769, bug 151234, bug 151610, and bug 194897.", "Before WebView on iOS 14, the event does not bubble, so document.addEventListener('visibilitychange', ...) works, but window.addEventListener('visibilitychange', ...) does not."]7–10.3["Doesn't fire thevisibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See bug 116769, bug 151234, bug 151610, and bug 194897.", "Before WebView on iOS 14, the event does not bubble, so document.addEventListener('visibilitychange', ...) works, but window.addEventListener('visibilitychange', ...) does not.", "The onvisibilitychange event handler property is not supported."] |
vlinkColor |
64 | 12 | 69 | 51 | 11 | 64 | 79 | 47 | 11 | 9.0 | 64 | 11 |
wasDiscarded |
68 | 79 | No | 55 | No | 68 | No | 48 | No | 10.0 | 68 | No |
write |
45 | 12 | 69 | 3 | 11 | 45 | 79 | 10.1 | 11 | 5.0 | 45 | 11 |
writeln |
45 | 12 | 69 | 51 | 11 | 45 | 79 | 47 | 11 | 5.0 | 45 | 11 |
xmlEncoding |
1 | 12 | 1–10 | 15 | 3 | 18 | 4–10 | 14 | 1 | 1.0 | 4.4 | 1 |
xmlStandalone |
1 | 12 | 1–10 | 15 | 3 | 18 | 4–10 | 14 | 1 | 1.0 | 4.4 | 1 |
xmlVersion |
1 | 12 | 1–10 | 15 | 3 | 18 | 4–10 | 14 | 1 | 1.0 | 4.4 | 1 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Document