DOM
DOM APIs are the foundation for reading and updating document structure in the browser. They power nearly every interactive feature built on top of HTML.
Overview
DOM APIs are the foundation for reading and updating document structure in the browser. They power nearly every interactive feature built on top of HTML.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 1 | 12 | 1 | 1 | 18 | 1 | |
| The read-only localName property of the Attr interface returns the local part of the qualified name of an attribute, that is the name of the attribute, stripped from any namespace in front of it. For example, if the qualified name is xml:lang, the returned local name is lang, if the element supports that namespace. | 1 | 12 | 1 | 1 | 18 | 1 |
| The read-only name property of the Attr interface returns the qualified name of an attribute, that is the name of the attribute, with the namespace prefix, if any, in front of it. For example, if the local name is lang and the namespace prefix is xml, the returned qualified name is xml:lang. | 1 | 12 | 1 | 1 | 18 | 1 |
| The read-only namespaceURI property of the Attr interface returns the namespace URI of the attribute, or null if the element is not in a namespace. | 1 | 12 | 1 | 1 | 18 | 1 |
| The read-only ownerElement property of the Attr interface returns the Element the attribute belongs to. | 1 | 12 | 1 | 1 | 18 | 1 |
| The read-only prefix property of the Attr returns the namespace prefix of the attribute, or null if no prefix is specified. | 1 | 12 | 1 | 1 | 18 | 1 |
| The value property of the Attr interface contains the value of the attribute. | 1 | 12 | 1 | 1 | 18 | 1 |
| The CDATASection interface represents a CDATA section that can be used within XML to include extended portions of unescaped text. When inside a CDATA section, the symbols < and & don't need escaping as they normally do. | 1 | 12 | 1 | 3 | 18 | 1 |
| The CharacterData abstract interface represents a Node object that contains characters. This is an abstract interface, meaning there aren't any objects of type CharacterData: it is implemented by other interfaces like Text, Comment, CDATASection, or ProcessingInstruction, which aren't abstract. | 1 | 12 | 1 | 1 | 18 | 1 |
| The after() method of the CharacterData interface inserts a set of Node objects or strings in the children list of the object's parent, just after the object itself. | 54 | 17 | 49 | 10 | 54 | 10 |
| The appendData() method of the CharacterData interface adds the provided data to the end of the node's current data. | 1 | 12 | 1 | 1 | 18 | 1 |
| The before() method of the CharacterData interface inserts a set of Node objects and strings in the children list of the CharacterData's parent, just before the CharacterData node. | 54 | 17 | 49 | 10 | 54 | 10 |
| The data property of the CharacterData interface represent the value of the current object's data. | 1 | 12 | 1 | 1 | 18 | 1 |
| The deleteData() method of the CharacterData interface removes all or part of the data from this CharacterData node. | 1 | 12 | 1 | 1 | 18 | 1 |
| The insertData() method of the CharacterData interface inserts the provided data into this CharacterData node's current data, at the provided offset from the start of the existing data. The provided data is spliced into the existing data. | 1 | 12 | 1 | 1 | 18 | 1 |
| The read-only CharacterData.length property returns the number of characters in the contained data, as a positive integer. | 1 | 12 | 1 | 1 | 18 | 1 |
| The read-only nextElementSibling property of the CharacterData interface returns the first Element node following the specified one in its parent's children list, or null if the specified element is the last one in the list. | 29 | 17 | 25 | 9 | 29 | 9 |
| The read-only previousElementSibling property of the CharacterData interface returns the first Element before the current node in its parent's children list, or null if there is none. | 29 | 17 | 25 | 9 | 29 | 9 |
| The remove() method of the CharacterData removes it from its parent node. If it has no parent node, calling remove() does nothing. | 24 | 12 | 23 | 7 | 25 | 7 |
| The replaceData() method of the CharacterData interface removes a certain number of characters of the existing text in a given CharacterData node and replaces those characters with the text provided. | 1 | 12 | 1 | 1 | 18 | 1 |
| The replaceWith() method of the CharacterData interface replaces this node in the children list of its parent with a set of Node objects or string. | 54 | 17 | 49 | 10 | 54 | 10 |
| The substringData() method of the CharacterData interface returns a portion of the existing data, starting at the specified index and extending for a given number of characters afterwards. | 1 | 12 | 1 | 1 | 18 | 1 |
| The Comment interface represents textual notations within markup; although it is generally not visually shown, such comments are available to be read in the source view. | 1 | 12 | 1 | 3 | 18 | 1 |
| The Comment() constructor returns a newly created Comment object with the optional string given in parameter as its textual content. | 29 | 16 | 24 | 8 | 29 | 8 |
| 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. | 1 | 12 | 1 | 1 | 18 | 1 |
| The activeElement read-only property of the Document interface returns the Element within the DOM that is receiving keyboard events such as Element/keydownevent and Element/keyupevent. This is usually analogous to the focused element. | 2 | 12 | 3 | 7 | 18 | 7 |
| Document.adoptNode() transfers a node/dom from another Document into the method's document. The adopted node and its subtree are removed from their original document (if any), and their Node.ownerDocument is changed to the current document. The node can then be inserted into the current document. | 1 | 12 | 1 | 3 | 18 | 1 |
| The Document.append() method inserts a set of Node objects or strings after the last child of the document. Strings are inserted as equivalent Text nodes. | 54 | 17 | 49 | 10 | 54 | 10 |
| The Document.body property represents the body or frameset node of the current document, or null if no such element exists. | 1 | 12 | 60 | 1 | 18 | 1 |
| The Document.characterSet read-only property returns the character encoding of the document that it's currently rendered with. | 1 | 12 | 1 | 3 | 18 | 1 |
| The Document.childElementCount read-only property returns the number of child elements of the document. | 29 | 17 | 25 | 9 | 29 | 9 |
| The read-only children property returns a live HTMLCollection which contains all of the child Element of the document upon which it was called. | 29 | 16 | 25 | 9 | 29 | 9 |
| The Document.compatMode read-only property indicates whether the document is rendered in Quirks mode or Standards mode. | 8 | 12 | 19 | 5.1 | 18 | 5 |
| The Document.contentType read-only property returns the MIME type that the document is being rendered as. This may come from HTTP headers or other sources of MIME information, and might be affected by automatic type conversions performed by either the browser or extensions. | 36 | 17 | 1 | 9 | 36 | 9 |
| The createAttribute() method of the Document interface creates a new attribute node. | 1 | 12 | 44 | 1 | 18 | 1 |
| The createAttributeNS() method of the Document interface creates a new attribute node with the specified namespace URI and qualified name. | 1 | 12 | 1 | 1 | 18 | 1 |
| createCDATASection() creates a new CDATA section node, and returns it. | 1 | 12 | 1 | 1 | 18 | 1 |
| createComment() creates a new comment node, and returns it. | 1 | 12 | 1 | 1 | 18 | 1 |
| Creates a new empty DocumentFragment into which DOM nodes can be added to build an offscreen DOM tree. | 1 | 12 | 1 | 1 | 18 | 1 |
| The createElement() method of the Document interface creates a new HTMLElement that has the specified localName. | 1 | 12 | 1 | 1 | 18 | 1 |
createElement (options parameter) `options` parameter | 56 | 79 | 50 | 26 | 56 | 26 |
| The createElementNS() method of the Document interface creates a new element with the specified namespace URI and qualified name. | 1 | 12 | 1 | 1 | 18 | 1 |
createElementNS (options parameter) `options` parameter | 56 | 79 | 50 | 26 | 56 | 26 |
| The Document.createNodeIterator() method returns a new NodeIterator object. | 1 | 12 | 1 | 3 | 18 | 1 |
| createProcessingInstruction() generates a new processing instruction node and returns it. | 1 | 12 | 1 | 1 | 18 | 1 |
| Creates a new Text node. This method can be used to escape HTML characters. | 1 | 12 | 1 | 1 | 18 | 1 |
| The Document.createTreeWalker() creator method returns a newly created TreeWalker object. | 1 | 12 | 1 | 3 | 18 | 3 |
createTreeWalker (whatToShow filter parameters optional) `whatToShow` and `filter` parameters are optional | 4 | 13 | 12 | 3 | 18 | 3 |
| The Document.currentScript property returns the script element whose script is currently being processed and isn't a JavaScript module. (For modules use import.meta instead.) | 29 | 12 | 4 | 8 | 29 | 8 |
| In browsers, document.defaultView returns the Window object associated with Browsing_context, or null if none is available. | 1 | 12 | 1 | 1 | 18 | 1 |
| The Document.dir property is a string representing the directionality of the text of the document, whether left to right (default) or right to left. Possible values are 'rtl', right to left, and 'ltr', left to right. | 36 | 12 | 1 | 10.1 | 36 | 10.3 |
| The doctype read-only property of the Document interface is a DocumentType object representing the Doctype associated with the current document. | 1 | 12 | 1 | 1 | 18 | 1 |
| The Document constructor creates a new Document object that is a web page loaded in the browser and serving as an entry point into the page's content. | 60 | 17 | 20 | 8 | 60 | 8 |
| The documentElement read-only property of the Document interface returns the Element that is the root element of the document (for example, the html element for HTML documents). | 1 | 12 | 1 | 1 | 18 | 1 |
| The documentURI read-only property of the Document interface returns the document location as a string. | 1 | 17 | 1 | 3 | 18 | 1 |
| The DOMContentLoaded event fires when the HTML document has been completely parsed, and all deferred scripts ( and ) have downloaded and executed. It doesn't wait for other things like images, subframes, and async scripts to finish loading. | 1 | 12 | 1 | 3.1 | 18 | 2 |
| The embeds read-only property of the Document interface returns a list of the embedded embed elements within the current document. | 36 | 12 | 61 | 10.1 | 36 | 10.3 |
| The Document.firstElementChild read-only property returns the document's first child Element, or null if there are no child elements. | 29 | 17 | 25 | 9 | 29 | 9 |
| The forms read-only property of the Document interface returns an HTMLCollection listing all the form elements contained in the document. | 1 | 12 | 61 | 4 | 18 | 3.2 |
| The getElementById() method of the Document interface returns an Element object representing the element whose Element.id property matches the specified string. Since element IDs are required to be unique if specified, they're a useful way to get access to a specific element quickly. | 1 | 12 | 1 | 1 | 18 | 1 |
| The getElementsByClassName method of Document interface returns an array-like object of all child elements which have all of the given class name(s). | 1 | 12 | 3 | 3.1 | 18 | 2 |
| The getElementsByName() method of the Document object returns a NodeList Collection of elements with a given name attribute in the document. | 1 | 12 | 58 | 4 | 18 | 3.2 |
| The getElementsByTagName method of Document interface returns an HTMLCollection of elements with the given tag name. | 1 | 12 | 1 | 1 | 18 | 1 |
| Returns a list of elements with the given tag name belonging to the given namespace. The complete document is searched, including the root node. | 1 | 12 | 1 | 1 | 18 | 1 |
| The hasFocus() method of the Document interface returns a boolean value indicating whether the document or any element inside the document has focus. This method can be used to determine whether the active element in a document has focus. | 34 | 12 | 3 | 7 | 34 | 7 |
| The head read-only property of the Document interface returns the head element of the current document. | 4 | 12 | 61 | 5 | 18 | 4 |
| The images read-only property of the Document interface returns a collection of the images in the current HTML document. | 1 | 12 | 61 | 4 | 18 | 3.2 |
| The Document.implementation property returns a DOMImplementation object associated with the current document. | 1 | 12 | 1 | 1 | 18 | 1 |
| The importNode() method of the Document interface creates a copy of a Node or DocumentFragment from another document, to be inserted into the current document later. | 1 | 12 | 1 | 1 | 18 | 1 |
| The Document.lastElementChild read-only property returns the document's last child Element, or null if there are no child elements. | 29 | 17 | 25 | 9 | 29 | 9 |
| The lastModified property of the Document interface returns a string containing the date and local time on which the current document was last modified. | 1 | 12 | 1 | 4 | 18 | 3.2 |
| The links read-only property of the Document interface returns a collection of all area elements and a elements in a document with a value for the href attribute. | 1 | 12 | 61 | 4 | 18 | 3.2 |
| The plugins read-only property of the Document interface returns an HTMLCollection object containing one or more HTMLEmbedElements representing the embed elements in the current document. | 36 | 12 | 61 | 10.1 | 36 | 10.3 |
| The Document.prepend() method inserts a set of Node objects or strings before the first child of the document. Strings are inserted as equivalent Text nodes. | 54 | 17 | 49 | 10 | 54 | 10 |
| The Document method querySelector() returns the first Element within the document that matches the specified CSS selector, or group of CSS selectors. If no matches are found, null is returned. | 1 | 12 | 3.5 | 3.1 | 18 | 2 |
| The Document method querySelectorAll() returns a static (not live) NodeList representing a list of the document's elements that match the specified group of selectors. | 1 | 12 | 3.5 | 3.1 | 18 | 2 |
| The Document.readyState property describes the loading state of the document. When the value of this property changes, a Document/readystatechange_event event fires on the document object. | 1 | 12 | 3.6 | 1 | 18 | 1 |
| The readystatechange event is fired when the Document.readyState attribute of a document has changed. | 9 | 12 | 4 | 5.1 | 18 | 5 |
| The Document.referrer property returns the URI of the page that linked to this page. | 1 | 12 | 1 | 1 | 18 | 1 |
| The Document.replaceChildren() method replaces the existing children of a Document with a specified new set of children. | 86 | 86 | 78 | 14 | 86 | 14 |
| The scripts property of the Document interface returns a list of the script elements in the document. The returned object is an HTMLCollection. | 36 | 12 | 61 | 10.1 | 36 | 10.3 |
| The document.title property gets or sets the current title of the document. When present, it defaults to the value of the . | 1 | 12 | 1 | 4 | 18 | 3.2 |
| The URL read-only property of the Document interface returns the document location as a string. | 1 | 12 | 19 | 3 | 18 | 2 |
| The DocumentFragment interface represents a minimal document object that has no parent. | 1 | 12 | 1 | 3 | 18 | 1 |
| The DocumentFragment.append() method inserts a set of Node objects or strings after the last child of the document fragment. Strings are inserted as equivalent Text nodes. | 54 | 17 | 49 | 10 | 54 | 10 |
| The DocumentFragment.childElementCount read-only property returns the number of child elements of a DocumentFragment. | 29 | 17 | 25 | 9 | 29 | 9 |
| The read-only children property returns a live HTMLCollection which contains all of the child Element of the document fragment upon which it was called. | 29 | 16 | 25 | 9 | 29 | 9 |
| The DocumentFragment() constructor returns a new, empty DocumentFragment object. | 29 | 17 | 24 | 8 | 29 | 8 |
| The DocumentFragment.firstElementChild read-only property returns the document fragment's first child Element, or null if there are no child elements. | 29 | 17 | 25 | 9 | 29 | 9 |
| The getElementById() method of the DocumentFragment returns an Element object representing the element whose Element.id property matches the specified string. Since element IDs are required to be unique if specified, they're a useful way to get access to a specific element quickly. | 36 | 17 | 28 | 9 | 36 | 9 |
| The DocumentFragment.lastElementChild read-only property returns the document fragment's last child Element, or null if there are no child elements. | 29 | 17 | 25 | 9 | 29 | 9 |
| The DocumentFragment.prepend() method inserts a set of Node objects or strings before the first child of the document fragment. Strings are inserted as equivalent Text nodes. | 54 | 17 | 49 | 10 | 54 | 10 |
| The DocumentFragment.querySelector() method returns the first element, or null if no matches are found, within the DocumentFragment (using depth-first pre-order traversal of the document's nodes) that matches the specified group of selectors. | 2 | 12 | 3.5 | 4 | 18 | 3 |
| The DocumentFragment.querySelectorAll() method returns a NodeList of elements within the DocumentFragment (using depth-first pre-order traversal of the document's nodes) that matches the specified group of selectors. | 2 | 12 | 3.5 | 4 | 18 | 3 |
| The DocumentFragment.replaceChildren() method replaces the existing children of a DocumentFragment with a specified new set of children. These can be string or Node objects. | 86 | 86 | 78 | 14 | 86 | 14 |
| The DocumentType interface represents a Node containing a doctype. | 1 | 12 | 1 | 3 | 18 | 1 |
| The DocumentType.after() method inserts a set of Node objects or strings in the children list of the DocumentType's parent, just after the DocumentType. Strings are inserted as equivalent Text nodes. | 54 | 17 | 49 | 10 | 54 | 10 |
| The DocumentType.before() method inserts a set of Node objects or strings in the children list of the DocumentType's parent, just before the DocumentType. Strings are inserted as equivalent Text nodes. | 54 | 17 | 49 | 10 | 54 | 10 |
| The read-only name property of the DocumentType returns the type of the document. | 1 | 12 | 1 | 3 | 18 | 1 |
| The read-only publicId property of the DocumentType returns a formal identifier of the document. | 1 | 12 | 1 | 3 | 18 | 1 |
| The DocumentType.remove() method removes a document's doctype. If it is already detached from the document, calling remove() does nothing. | 24 | 12 | 23 | 7 | 25 | 7 |
| The DocumentType.replaceWith() method replaces the document type with a set of given nodes. | 54 | 17 | 49 | 10 | 54 | 10 |
| The read-only systemId property of the DocumentType returns the URL of the associated DTD. | 1 | 12 | 1 | 3 | 18 | 1 |
| The DOMException interface represents an abnormal event (called an exception) that occurs as a result of calling a method or accessing a property of a web API. This is how error conditions are described in web APIs. | 1 | 12 | 1 | 1 | 18 | 1 |
| The DOMException() constructor returns a DOMException object with a specified message and name. | 46 | 79 | 37 | 10.1 | 46 | 10.3 |
| The message read-only property of the DOMException interface returns a string representing a message or description associated with the given error name. | 1 | 12 | 1 | 1 | 18 | 1 |
| The name read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name. | 1 | 12 | 1 | 1 | 18 | 1 |
| The DOMImplementation interface represents an object providing methods which are not dependent on any particular document. Such an object is returned by the Document.implementation property. | 1 | 12 | 1 | 1 | 18 | 1 |
| The createDocument() method of the DOMImplementation interface creates and returns an XMLDocument. | 1 | 12 | 1 | 1 | 18 | 1 |
| The DOMImplementation.createDocumentType() method returns a DocumentType object which can either be used with DOMImplementation.createDocument upon document creation or can be put into the document via methods like Node.insertBefore() or Node.replaceChild(). | 1 | 12 | 1 | 1 | 18 | 1 |
| The DOMImplementation.createHTMLDocument() method creates a new HTML . | 1 | 12 | 4 | 1 | 18 | 1 |
| The DOMStringList interface is a legacy type returned by some APIs and represents a non-modifiable list of strings (DOMString). | 1 | 12 | 1 | 5.1 | 18 | 5 |
| The contains() method returns a boolean indicating whether the given string is in the list. | 1 | 12 | 1.5 | 5.1 | 18 | 5 |
| The item() method returns a string from a DOMStringList by index. | 1 | 12 | 1 | 5.1 | 18 | 5 |
| The read-only length property indicates the number of strings in the DOMStringList. | 1 | 12 | 1 | 5.1 | 18 | 5 |
| The DOMTokenList interface represents a set of space-separated tokens. Such a set is returned by Element.classList or HTMLLinkElement.relList, and many others. | 8 | 12 | 3.6 | 5.1 | 18 | 5 |
@@iterator [Symbol.iterator] | 42 | 16 | 36 | 10.1 | 42 | 10.3 |
| The add() method of the DOMTokenList interface adds the given tokens to the list, omitting any that are already present. | 8 | 12 | 3.6 | 5.1 | 18 | 5 |
add (multiple parameters) Multiple parameters for `add()` | 24 | 12 | 26 | 7 | 25 | 7 |
| The contains() method of the DOMTokenList interface returns a boolean value — true if the underlying list contains the given token, otherwise false. | 8 | 12 | 3.6 | 5.1 | 18 | 5 |
| The entries() method of the DOMTokenList interface returns an Iteration_protocols allowing you to go through all key/value pairs contained in this object. The values are Arrays which have [key, value] pairs, each representing a single token. | 42 | 16 | 50 | 10.1 | 42 | 10.3 |
| The forEach() method of the DOMTokenList interface calls the callback given in parameter once for each value pair in the list, in insertion order. | 42 | 16 | 50 | 10.1 | 42 | 10.3 |
| The item() method of the DOMTokenList interface returns an item in the list, determined by its position in the list, its index. | 8 | 12 | 3.6 | 5.1 | 18 | 5 |
| The keys() method of the DOMTokenList interface returns an Iteration_protocols allowing to go through all keys contained in this object. The keys are unsigned integers. | 42 | 16 | 50 | 10.1 | 42 | 10.3 |
| The read-only length property of the DOMTokenList interface is an integer representing the number of objects stored in the object. | 8 | 12 | 3.6 | 5.1 | 18 | 5 |
| The remove() method of the DOMTokenList interface removes the specified tokens from the list. | 8 | 12 | 3.6 | 5.1 | 18 | 5 |
| Methods that modify the DOMTokenList (such as DOMTokenList.add()) automatically trim any excess Whitespace and remove duplicate values from the list. For example: | 60 | 17 | 55 | 10 | 60 | 10 |
remove (multiple parameters) Multiple parameters for `remove()` | 24 | 12 | 26 | 7 | 25 | 7 |
| The replace() method of the DOMTokenList interface replaces an existing token with a new token. If the first token doesn't exist, replace() returns false immediately, without adding the new token to the token list. | 61 | 17 | 49 | 10.1 | 61 | 10.3 |
replace (boolean value) `return()`'s value is a boolean, not void as it used to be. | 67 | 18 | 61 | 12 | 67 | 12 |
| The supports() method of the DOMTokenList interface returns true if a given token is in the associated attribute's supported tokens. This method is intended to support feature detection. | 49 | 17 | 49 | 10.1 | 49 | 10.3 |
| The toggle() method of the DOMTokenList interface removes an existing token from the list and returns false. If the token doesn't exist it's added and the function returns true. | 8 | 12 | 3.6 | 5.1 | 18 | 5 |
toggle (force parameter) `force` parameter | 24 | 12 | 24 | 7 | 25 | 7 |
| The toString() stringifier method of the DOMTokenList interface returns the values of the token list serialized as a string. The return value is a space-separated list of tokens equal to the DOMTokenList.value property. | 8 | 12 | 3.6 | 5.1 | 18 | 5 |
| Methods that modify the DOMTokenList (such as DOMTokenList.add()) automatically trim any excess Whitespace and remove duplicate values from the list. For example: | 48 | 12 | 51 | 10 | 48 | 10 |
| The value property of the DOMTokenList interface is a stringifier that returns the value of the list serialized as a string, or clears and sets the list to the given value. | 50 | 17 | 47 | 10 | 50 | 10 |
| The values() method of the DOMTokenList interface returns an Iteration_protocols allowing the caller to go through all values contained in the DOMTokenList. The individual values are strings. | 42 | 16 | 50 | 10.1 | 42 | 10.3 |
| Element is the most general base class from which all element objects (i.e., objects that represent elements) in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element. | 1 | 12 | 1 | 1 | 18 | 1 |
| The Element.after() method inserts a set of Node objects or strings in the children list of the Element's parent, just after the Element. Strings are inserted as equivalent Text nodes. | 54 | 17 | 49 | 10 | 54 | 10 |
| The Element.append() method inserts a set of Node objects or strings after the last child of the Element. Strings are inserted as equivalent Text nodes. | 54 | 17 | 49 | 10 | 54 | 10 |
| The Element.attributes property returns a live collection of all attribute nodes registered to the specified node. It is a NamedNodeMap, not an Array, so it has no Array methods and the Attr nodes' indexes may differ among browsers. To be more specific, attributes is a key/value pair of strings that represents any information regarding that attribute. | 1 | 12 | 1 | 1 | 18 | 1 |
| The Element.before() method inserts a set of Node objects or strings in the children list of this Element's parent, just before this Element. Strings are inserted as equivalent Text nodes. | 54 | 17 | 49 | 10 | 54 | 10 |
| The Element.childElementCount read-only property returns the number of child elements of this element. | 2 | 12 | 3.5 | 4 | 18 | 3 |
| The read-only children property returns a live HTMLCollection which contains all of the child Element of the element upon which it was called. | 1 | 12 | 3.5 | 4 | 18 | 3 |
| The read-only classList property of the Element interface contains a live DOMTokenList collection representing the class attribute of the element. This can then be used to manipulate the class list. | 22 | 16 | 3.6 | 7 | 25 | 7 |
| The className property of the Element interface gets and sets the value of the class attribute of the specified element. | 22 | 12 | 1 | 1 | 25 | 1 |
| The clientHeight read-only property of the Element interface is zero for elements with no CSS or inline layout boxes; otherwise, it's the inner height of an element in pixels. It includes padding but excludes borders, margins, and horizontal scrollbars (if present). | 1 | 12 | 1 | 3 | 18 | 1 |
| The clientLeft read-only property of the Element interface returns the width of the left border of an element in pixels. It includes the width of the vertical scrollbar if the text direction of the element is right-to-left and if there is an overflow causing a left vertical scrollbar to be rendered. clientLeft does not include the left margin or the left… | 1 | 12 | 3 | 3 | 18 | 1 |
| The clientTop read-only property of the Element interface returns the width of the top border of an element in pixels. | 1 | 12 | 3 | 3 | 18 | 1 |
| The clientWidth read-only property of the Element interface is zero for inline elements and elements with no CSS; otherwise, it's the inner width of an element in pixels. It includes padding but excludes borders, margins, and vertical scrollbars (if present). | 1 | 12 | 1 | 3 | 18 | 1 |
| The closest() method of the Element interface traverses the element and its parents (heading toward the document root) until it finds a node that matches the specified CSS selector. | 41 | 15 | 35 | 6 | 41 | 9 |
| The currentCSSZoom read-only property of the Element interface provides the "effective" CSS zoom of an element, taking into account the zoom applied to the element and all its parent elements. | 128 | 128 | 126 | 26.4 | 128 | 26.4 |
| The Element.firstElementChild read-only property returns an element's first child Element, or null if there are no child elements. | 2 | 12 | 3.5 | 4 | 18 | 3 |
| The getAttribute() method of the Element interface returns the value of a specified attribute on the element. | 1 | 12 | 1 | 1 | 18 | 1 |
| The getAttributeNames() method of the Element interface returns the attribute names of the element as an Array of strings. If the element has no attributes it returns an empty array. | 61 | 18 | 45 | 10.1 | 61 | 10.3 |
| Returns the specified attribute of the specified element, as an Attr node. | 1 | 12 | 1 | 1 | 18 | 1 |
| The getAttributeNodeNS() method of the Element interface returns the namespaced Attr node of an element. | 1 | 12 | 1 | 1 | 18 | 1 |
| The getAttributeNS() method of the Element interface returns the string value of the attribute with the specified namespace and name. If the named attribute does not exist, the value returned will either be null or "" (the empty string); see Notes for details. | 1 | 12 | 1 | 1 | 18 | 1 |
| The Element.getBoundingClientRect() method returns a DOMRect object providing information about the size of an element and its position relative to the viewport. | 2 | 12 | 3 | 4 | 18 | 3.2 |
| The getClientRects() method of the Element interface returns a collection of DOMRect objects that indicate the bounding rectangles for each CSS border box in a client. | 2 | 12 | 3 | 4 | 18 | 3.2 |
| The Element method getElementsByClassName() returns a live HTMLCollection which contains every descendant element which has the specified class name or names. | 1 | 16 | 3 | 3.1 | 18 | 2 |
| The Element.getElementsByTagName() method returns a live HTMLCollection of elements with the given tag name. | 1 | 12 | 1 | 1 | 18 | 1 |
getElementsByTagName (all elements selector) `getElementsByTagName("*")` | 1 | 12 | 1 | 1 | 18 | 1 |
| The Element.getElementsByTagNameNS() method returns a live HTMLCollection of elements with the given tag name belonging to the given namespace. It is similar to Document.getElementsByTagNameNS, except that its search is restricted to descendants of the specified element. | 1 | 12 | 1 | 1 | 18 | 1 |
getElementsByTagNameNS (all elements selector) `getElementsByTagNameNS(namespaceURI, "*")` | 1 | 12 | 1 | 1 | 18 | 1 |
| The Element.hasAttribute() method returns a Boolean value indicating whether the specified element has the specified attribute or not. | 1 | 12 | 1 | 1 | 18 | 1 |
| The hasAttributeNS() method of the Element interface returns a boolean value indicating whether the current element has the specified attribute with the specified namespace. | 1 | 12 | 1 | 1 | 18 | 1 |
| The hasAttributes() method of the Element interface returns a boolean value indicating whether the current element has any attributes or not. | 1 | 12 | 1 | 1 | 18 | 1 |
| The id property of the Element interface represents the element's identifier, reflecting the id global attribute. | 23 | 12 | 1 | 1 | 25 | 1 |
| The innerHTML property of the Element interface gets or sets the HTML or XML markup contained within the element, omitting any shadow tree in both cases. | 1 | 12 | 1 | 1 | 18 | 1 |
| The insertAdjacentElement() method of the Element interface inserts a given element node at a given position relative to the element it is invoked upon. | 1 | 17 | 48 | 3 | 18 | 1 |
| The insertAdjacentHTML() method of the Element interface parses the specified input as HTML or XML and inserts the resulting nodes into the DOM tree at a specified position. | 1 | 17 | 8 | 4 | 18 | 4 |
| The insertAdjacentText() method of the Element interface, given a relative position and a string, inserts a new text node at the given position relative to the element it is called from. | 1 | 17 | 48 | 4 | 18 | 4 |
| The Element.lastElementChild read-only property returns an element's last child Element, or null if there are no child elements. | 2 | 12 | 3.5 | 4 | 18 | 3 |
| The Element.localName read-only property returns the local part of the qualified name of an element. | 1 | 12 | 1 | 1 | 18 | 1 |
| The matches() method of the Element interface tests whether the element would be selected by the specified CSS selector. | 33 | 15 | 34 | 8 | 33 | 8 |
| The Element.namespaceURI read-only property returns the namespace URI of the element, or null if the element is not in a namespace. | 1 | 12 | 1 | 1 | 18 | 1 |
| The Element.nextElementSibling read-only property returns the element immediately following the specified one in its parent's Element.children list, or null if the specified element is the last one in the list. | 2 | 12 | 3.5 | 4 | 18 | 3 |
| The outerHTML attribute of the Element interface gets or sets the HTML or XML markup of the element and its descendants, omitting any shadow tree in both cases. | 1 | 12 | 11 | 1.3 | 18 | 1 |
| The Element.prefix read-only property returns the namespace prefix of the specified element, or null if no prefix is specified. | 1 | 12 | 1 | 1 | 18 | 1 |
| The Element.prepend() method inserts a set of Node objects or strings before the first child of the Element. Strings are inserted as equivalent Text nodes. | 54 | 17 | 49 | 10 | 54 | 10 |
| The Element.previousElementSibling read-only property returns the Element immediately prior to the specified one in its parent's Element.children list, or null if the specified element is the first one in the list. | 2 | 12 | 3.5 | 4 | 18 | 3 |
| The querySelector() method of the Element interface returns the first element that is a descendant of the element on which it is invoked that matches the specified group of selectors. | 1 | 12 | 3.5 | 3.1 | 18 | 2 |
| The Element method querySelectorAll() returns a static (not live) NodeList representing a list of elements matching the specified group of selectors which are descendants of the element on which the method was called. | 1 | 12 | 3.5 | 3.1 | 18 | 2 |
| The Element.remove() method removes the element from its parent node. If it has no parent node, calling remove() does nothing. | 24 | 12 | 23 | 7 | 25 | 7 |
| The Element method removeAttribute() removes the attribute with the specified name from the element. | 1 | 12 | 1 | 1 | 18 | 1 |
| The removeAttributeNode() method of the Element interface removes the specified Attr node from the element. | 1 | 12 | 1 | 1 | 18 | 1 |
| The removeAttributeNS() method of the Element interface removes the specified attribute with the specified namespace from an element. | 1 | 12 | 1 | 1 | 18 | 1 |
| The Element.replaceChildren() method replaces the existing children of a Node with a specified new set of children. These can be string or Node objects. | 86 | 86 | 78 | 14 | 86 | 14 |
| The Element.replaceWith() method replaces this Element in the children list of its parent with a set of Node objects or strings. Strings are inserted as equivalent Text nodes. | 54 | 17 | 49 | 10 | 54 | 10 |
| The setAttribute() method of the Element interface sets the value of an attribute on the specified element. If the attribute already exists, the value is updated; otherwise a new attribute is added with the specified name and value. | 1 | 12 | 1 | 1 | 18 | 1 |
| The setAttributeNode() method of the Element interface adds a new Attr node to the specified element. | 1 | 12 | 1 | 1 | 18 | 1 |
| The setAttributeNodeNS() method of the Element interface adds a new namespaced Attr node to an element. | 1 | 12 | 1 | 1 | 18 | 1 |
| The setAttributeNS() method of the Element interface adds a new attribute or changes the value of an attribute with the given namespace and name. | 1 | 12 | 1 | 1 | 18 | 1 |
| The tagName read-only property of the Element interface returns the tag name of the element on which it's called. | 1 | 12 | 1 | 1 | 18 | 1 |
| The toggleAttribute() method of the Element interface toggles a Boolean attribute on the given element, removing it if present and adding it if not present. | 69 | 18 | 63 | 12 | 69 | 12 |
| The HTMLCollection interface represents a generic collection (array-like object similar to Functions/arguments) of elements (in document order) and offers methods and properties for selecting from the list. | 1 | 12 | 1 | 1 | 18 | 1 |
| The HTMLCollection method item() returns the element located at the specified offset into the collection. | 1 | 12 | 1 | 1 | 18 | 1 |
| The HTMLCollection.length property returns the number of items in a HTMLCollection. | 1 | 12 | 1 | 1 | 18 | 1 |
| The namedItem() method of the HTMLCollection interface returns the first Element in the collection whose id or name attribute match the specified name, or null if no element matches. | 1 | 12 | 1 | 1 | 18 | 1 |
| For historical reasons, Window objects have a window.HTMLDocument property whose value is the Document interface. So you can think of HTMLDocument as an alias for Document, and you can find documentation for HTMLDocument members under the documentation for the Document interface. | 1 | 12 | 1 | 1 | 18 | 1 |
| The HTMLElement interface represents any HTML element. Some elements directly implement this interface, while others implement it via an interface that inherits it. | 1 | 12 | 1 | 1 | 18 | 1 |
| The HTMLElement.dir property indicates the text writing directionality of the content of the current element. It reflects the element's dir attribute. | 1 | 12 | 1 | 3 | 18 | 1 |
| The HTMLElement property hidden reflects the value of the element's hidden attribute. | 6 | 12 | 4 | 5.1 | 18 | 5 |
| The innerText property of the HTMLElement interface represents the rendered text content of a node and its descendants. | 1 | 12 | 45 | 1 | 18 | 1 |
| The load event fires for elements containing a resource when the resource has successfully loaded. Currently, the list of supported HTML elements are: body, embed, iframe, img, link, object, script, style, and track. | 1 | 12 | 1 | 1.3 | 18 | 1 |
| The offsetHeight read-only property of the HTMLElement interface returns the height of an element, including vertical padding and borders, as an integer. | 1 | 12 | 1 | 3 | 18 | 1 |
| The offsetLeft read-only property of the HTMLElement interface returns the number of pixels that the upper left corner of the current element is offset to the left within the HTMLElement.offsetParent node. | 1 | 12 | 1 | 3 | 18 | 1 |
| The HTMLElement.offsetParent read-only property returns a reference to the element which is the closest (nearest in the containment hierarchy) positioned ancestor element. | 1 | 12 | 1 | 3 | 18 | 1 |
| The offsetTop read-only property of the HTMLElement interface returns the distance from the outer border of the current element (including its margin) to the top padding edge of the HTMLelement.offsetParent, the closest positioned ancestor element. | 1 | 12 | 1 | 3 | 18 | 1 |
| The offsetWidth read-only property of the HTMLElement interface returns the layout width of an element as an integer. | 1 | 12 | 1 | 3 | 18 | 1 |
| The outerText property of the HTMLElement interface returns the same value as HTMLElement.innerText. When used as a setter it replaces the whole current node with the given text (this differs from innerText, which replaces the content inside the current node). | 1 | 12 | 98 | 1.3 | 18 | 1 |
| The NamedNodeMap interface represents a collection of Attr objects. Objects inside a NamedNodeMap are not in any particular order, unlike NodeList, although they may be accessed by an index as in an array. | 1 | 12 | 34 | 1 | 18 | 1 |
| The getNamedItem() method of the NamedNodeMap interface returns the Attr corresponding to the given name, or null if there is no corresponding attribute. | 1 | 12 | 1 | 1 | 18 | 1 |
| The getNamedItemNS() method of the NamedNodeMap interface returns the Attr corresponding to the given local name in the given namespace, or null if there is no corresponding attribute. | 1 | 12 | 1 | 1 | 18 | 1 |
| The item() method of the NamedNodeMap interface returns the item in the map matching the index. | 1 | 12 | 1 | 1 | 18 | 1 |
| The read-only length property of the NamedNodeMap interface is the number of objects stored in the map. | 1 | 12 | 1 | 1 | 18 | 1 |
| The removeNamedItem() method of the NamedNodeMap interface removes the Attr corresponding to the given name from the map. | 1 | 12 | 1 | 1 | 18 | 1 |
| The removeNamedItemNS() method of the NamedNodeMap interface removes the Attr corresponding to the given namespace and local name from the map. | 1 | 12 | 1 | 1 | 18 | 1 |
| The setNamedItem() method of the NamedNodeMap interface puts the Attr identified by its name in the map. If there is already an Attr with the same name in the map, it is replaced. | 1 | 12 | 1 | 1 | 18 | 1 |
| The setNamedItemNS() method of the NamedNodeMap interface puts the Attr identified by its name in the map. If there was already an Attr with the same name in the map, it is replaced. | 1 | 12 | 1 | 1 | 18 | 1 |
| The DOM Node interface is an abstract base class upon which many other DOM API objects are based, thus letting those object types be used similarly and often interchangeably. As an abstract class, there is no such thing as a plain Node object. All objects that implement Node functionality are based on one of its subclasses. Most notable are Document,… | 1 | 12 | 1 | 1 | 18 | 1 |
| The appendChild() method of the Node interface adds a node to the end of the list of children of a specified parent node. | 1 | 12 | 1 | 1.1 | 18 | 1 |
| The read-only baseURI property of the Node interface returns the absolute base URL of the document containing the node. | 1 | 12 | 1 | ≤4 | 18 | 1 |
| The read-only childNodes property of the Node interface returns a live NodeList of child Node of the given element where the first child node is assigned index 0. Child nodes include elements, text and comments. | 1 | 12 | 1 | 1.2 | 18 | 1 |
| The cloneNode() method of the Node interface returns a duplicate of the node on which this method was called. Its parameter controls if the subtree contained in the node is also cloned or not. | 1 | 12 | 1 | 1.1 | 18 | 1 |
| The compareDocumentPosition() method of the Node interface reports the position of its argument node relative to the node on which it is called. | 2 | 12 | 1 | 4 | 18 | 3.2 |
| The contains() method of the Node interface returns a boolean value indicating whether a node is a descendant of a given node, that is the node itself, one of its direct children (Node.childNodes), one of the children's direct children, and so on. | 16 | 12 | 9 | 1.1 | 18 | 1 |
| The read-only firstChild property of the Node interface returns the node's first child in the tree, or null if the node has no children. | 1 | 12 | 1 | 1 | 18 | 1 |
| The hasChildNodes() method of the Node interface returns a boolean value indicating whether the given Node has child nodes or not. | 1 | 12 | 1 | 1 | 18 | 1 |
| The insertBefore() method of the Node interface inserts a node before a reference node as a child of a specified parent node. | 1 | 12 | 1 | 1.1 | 18 | 1 |
| The isDefaultNamespace() method of the Node interface accepts a namespace URI as an argument. It returns a boolean value that is true if the namespace is the default namespace on the given node and false if not. The default namespace can be retrieved with Node.lookupNamespaceURI() by passing null as the argument. | 1 | 12 | 1 | 3 | 18 | 1 |
| The isEqualNode() method of the Node interface tests whether two nodes are equal. Two nodes are equal when they have the same type, defining characteristics (for elements, this would be their ID, number of children, and so forth), its attributes match, and so on. The specific set of data points that must match varies depending on the types of the nodes. | 1 | 12 | 1 | 3 | 18 | 1 |
| The isSameNode() method of the Node interface is a legacy alias the for the === strict equality operator. That is, it tests whether two nodes are the same (in other words, whether they reference the same object). | 1 | 12 | 48 | 3 | 18 | 1 |
| The read-only lastChild property of the Node interface returns the last child of the node, or null if there are no child nodes. | 1 | 12 | 1 | 1 | 18 | 1 |
| The lookupNamespaceURI() method of the Node interface takes a prefix as parameter and returns the namespace URI associated with it on the given node if found (and null if not). This method's existence allows Node objects to be passed as a namespace resolver to XPathEvaluator.createExpression() and XPathEvaluator.evaluate(). | 1 | 12 | 1 | 3 | 18 | 1 |
| The lookupPrefix() method of the Node interface returns a string containing the prefix for a given namespace URI, if present, and null if not. When multiple prefixes are possible, the first prefix is returned. | 1 | 12 | 1 | 3 | 18 | 1 |
| The read-only nextSibling property of the Node interface returns the node immediately following the specified one in their parent's Node.childNodes, or returns null if the specified node is the last child in the parent element. | 1 | 12 | 1 | 1.1 | 18 | 1 |
| The read-only nodeName property of Node returns the name of the current node as a string. | 1 | 12 | 1 | 1 | 18 | 1 |
| The read-only nodeType property of a Node interface is an integer that identifies what the node is. It distinguishes different kinds of nodes from each other, such as Element, Text, and Comment. | 1 | 12 | 1 | 1.1 | 18 | 1 |
| The nodeValue property of the Node interface returns or sets the value of the current node. | 1 | 12 | 1 | 1 | 18 | 1 |
| The normalize() method of the Node interface puts the specified node and all of its sub-tree into a normalized form. In a normalized sub-tree, no text nodes in the sub-tree are empty and there are no adjacent text nodes. | 1 | 12 | 1 | 1 | 18 | 1 |
| The read-only ownerDocument property of the Node interface returns the top-level document object of the node. | 1 | 12 | 9 | 1 | 18 | 1 |
| The read-only parentElement property of Node interface returns the DOM node's parent Element, or null if the node either has no parent, or its parent isn't a DOM Element. Node.parentNode on the other hand returns any kind of parent, regardless of its type. | 1 | 12 | 9 | 1.1 | 18 | 1 |
| The read-only parentNode property of the Node interface returns the parent of the specified node in the DOM tree. | 1 | 12 | 1 | 1.1 | 18 | 1 |
| The read-only previousSibling property of the Node interface returns the node immediately preceding the specified one in its parent's Node.childNodes list, or null if the specified node is the first in that list. | 1 | 12 | 1 | 1 | 18 | 1 |
| The removeChild() method of the Node interface removes a child node from the DOM and returns the removed node. | 1 | 12 | 1 | 1.1 | 18 | 1 |
| The replaceChild() method of the Node interface replaces a child node within the given (parent) node. | 1 | 12 | 1 | 1.1 | 18 | 1 |
| The textContent property of the Node interface represents the text content of the node and its descendants. | 1 | 12 | 1 | 3 | 18 | 1 |
| The NodeIterator interface represents an iterator to traverse nodes of a DOM subtree in document order. | 1 | 12 | 3.5 | 3 | 18 | 3 |
| The NodeIterator.filter read-only property returns a NodeFilter object, that is an object which implements an acceptNode(node) method, used to screen nodes. | 1 | 12 | 3.5 | 3 | 18 | 3 |
| The NodeIterator.nextNode() method returns the next node in the set represented by the NodeIterator and advances the position of the iterator within the set. The first call to nextNode() returns the first node in the set. | 1 | 12 | 3.5 | 3 | 18 | 3 |
| The NodeIterator.pointerBeforeReferenceNode read-only property returns a boolean flag that indicates whether the NodeFilter is anchored before (if this value is true) or after (if this value is false) the anchor node indicated by the NodeIterator.referenceNode property. | 1 | 17 | 3.5 | 3 | 18 | 3 |
| The NodeIterator.previousNode() method returns the previous node in the set represented by the NodeIterator and moves the position of the iterator backwards within the set. | 1 | 12 | 3.5 | 3 | 18 | 3 |
| The NodeIterator.referenceNode read-only property returns the Node to which the iterator is anchored; as new nodes are inserted, the iterator remains anchored to the reference node as specified by this property. | 1 | 17 | 3.5 | 3 | 18 | 3 |
| The NodeIterator.root read-only property represents the Node that is the root of what the NodeIterator traverses. | 1 | 12 | 3.5 | 3 | 18 | 3 |
| The NodeIterator.whatToShow read-only property represents an unsigned integer representing a bitmask signifying what types of nodes should be returned by the NodeIterator. | 1 | 12 | 3.5 | 3 | 18 | 3 |
| NodeList objects are collections of nodes, usually returned by properties such as Node.childNodes and methods such as document.querySelectorAll(). | 1 | 12 | 1 | 1 | 18 | 1 |
@@iterator [Symbol.iterator] | 51 | 79 | 36 | 10 | 51 | 10 |
| The NodeList.entries() method returns an Iteration_protocols allowing to go through all key/value pairs contained in this object. The values are Node objects. | 51 | 16 | 50 | 10 | 51 | 10 |
| The forEach() method of the NodeList interface calls the callback given in parameter once for each value pair in the list, in insertion order. | 51 | 16 | 50 | 10 | 51 | 10 |
| Returns a node from a NodeList by index. This method doesn't throw exceptions as long as you provide arguments. A value of null is returned if the index is out of range, and a TypeError is thrown if no argument is provided. | 1 | 12 | 1 | 1 | 18 | 1 |
| The NodeList.keys() method returns an Iteration_protocols allowing to go through all keys contained in this object. The keys are unsigned integer. | 51 | 16 | 50 | 10 | 51 | 10 |
| The NodeList.length property returns the number of items in a NodeList. | 1 | 12 | 1 | 1 | 18 | 1 |
| The NodeList.values() method returns an Iteration_protocols allowing to go through all values contained in this object. The values are Node objects. | 51 | 16 | 50 | 10 | 51 | 10 |
| The ProcessingInstruction interface represents a processing instruction; that is, a Node which embeds an instruction targeting a specific application but that can be ignored by any other applications which don't recognize the instruction. | 1 | 12 | 1 | 1 | 18 | 1 |
| The read-only target property of the ProcessingInstruction interface represent the application to which the ProcessingInstruction is targeted. | 1 | 12 | 1 | 1 | 18 | 1 |
| The Text interface represents a text Node in a DOM tree. | 1 | 12 | 1 | 1 | 18 | 1 |
| The splitText() method of the Text interface breaks the Text node into two nodes at the specified offset, keeping both nodes in the tree as siblings. | 1 | 12 | 1 | 1 | 18 | 1 |
| The Text() constructor returns a new Text object with the optional string given in parameter as its textual content. | 29 | 16 | 24 | 8 | 29 | 8 |
| The read-only wholeText property of the Text interface returns the full text of all Text nodes logically adjacent to the node. The text is concatenated in document order. This allows specifying any text node and obtaining all adjacent text as a single string. | 2 | 12 | 3.5 | 4 | 18 | 3.2 |
| The TreeWalker object represents the nodes of a document subtree and a position within them. | 1 | 12 | 4 | 3 | 18 | 3 |
| The TreeWalker.currentNode property represents the Node which the TreeWalker is currently pointing at. | 1 | 12 | 4 | 3 | 18 | 3 |
| The TreeWalker.filter read-only property returns the NodeFilter associated with the TreeWalker. | 1 | 12 | 4 | 3 | 18 | 3 |
| The TreeWalker.firstChild() method moves the current Node to the first visible child of the current node, and returns the found child. If no such child exists, it returns null and the current node is not changed. | 1 | 12 | 4 | 3 | 18 | 3 |
| The TreeWalker.lastChild() method moves the current Node to the last visible child of the current node, and returns the found child. If no such child exists, it returns null and the current node is not changed. | 1 | 12 | 4 | 3 | 18 | 3 |
| The TreeWalker.nextNode() method moves the current Node to the next visible node in the document order, and returns the found node. If no such node exists, it returns null and the current node is not changed. | 1 | 12 | 4 | 3 | 18 | 3 |
| The TreeWalker.nextSibling() method moves the current Node to its next sibling, if any, and returns the found sibling. If there is no such node, it returns null and the current node is not changed. | 1 | 12 | 4 | 3 | 18 | 3 |
| The TreeWalker.parentNode() method moves the current Node to the first visible ancestor node in the document order, and returns the found node. If no such node exists, or if it is above the TreeWalker's root node, it returns null and the current node is not changed. | 1 | 12 | 4 | 3 | 18 | 3 |
| The TreeWalker.previousNode() method moves the current Node to the previous visible node in the document order, and returns the found node. If no such node exists, or if it is before that the root node defined at the object construction, it returns null and the current node is not changed. | 1 | 12 | 4 | 3 | 18 | 3 |
| The TreeWalker.previousSibling() method moves the current Node to its previous sibling, if any, and returns the found sibling. If there is no such node, it returns null and the current node is not changed. | 1 | 12 | 4 | 3 | 18 | 3 |
| The TreeWalker.root read-only property returns the root Node that the TreeWalker traverses. | 1 | 12 | 4 | 3 | 18 | 3 |
| The TreeWalker.whatToShow read-only property returns a bitmask that indicates the types of nodes to show. Non-matching nodes are skipped, but their children may be included, if relevant. | 1 | 12 | 4 | 3 | 18 | 3 |
| window.document returns a reference to the document contained in the window. | 1 | 12 | 1 | 1 | 18 | 1 |
| The XMLDocument interface represents an XML document. It inherits from the generic Document and does not add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents. | 34 | 12 | 1 | 10 | 34 | 10 |
- This browser only partially implements this feature
- This feature was removed in a later browser version (7)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (7)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (60)
- Only supported for `HTMLDocument`, not all `Document` objects.
- Previously available under a different name: charset (1)
- `charset` alias was made read-only in Chrome 45.
- Previously available under a different name: inputEncoding (1)
- Previously available under a different name: charset (12)
- Previously available under a different name: inputEncoding (12)
- Previously available under a different name: charset (44)
- Previously available under a different name: inputEncoding (1.5)
- Previously available under a different name: charset (3)
- Previously available under a different name: inputEncoding (3)
- Previously available under a different name: charset (18)
- `charset` alias was made read-only in Chrome Android 45.
- Previously available under a different name: inputEncoding (18)
- Previously available under a different name: charset (1)
- Previously available under a different name: inputEncoding (1)
- This browser only partially implements this feature
- This feature was removed in a later browser version (8)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (19)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (5.1)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (5)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This feature was removed in a later browser version (44)
- The parameter was not converted to its lowercase variant.
- Doesn't conform to the DOM spec for XUL and XHTML documents: `localName` and `namespaceURI` are not set to null on the created element.
- For backwards compatibility, the `options` parameter can be an object or a string with the custom element tag name, although the string version is deprecated.
- For backwards compatibility, the `options` parameter can be an object or a string with the custom element tag name, although the string version is deprecated.
- Firefox accepts a string instead of an object here, but only from version 51 onwards. In version 50, options must be an object.
- For backwards compatibility, the `options` parameter can be an object or a string with the custom element tag name, although the string version is deprecated.
- Doesn't conform to the DOM spec for XUL and XHTML documents: `localName` and `namespaceURI` are not set to null on the created element.
- For backwards compatibility, the `options` parameter can be an object or a string with the custom element tag name, although the string version is deprecated.
- For backwards compatibility, the `options` parameter can be an object or a string with the custom element tag name, although the string version is deprecated.
- Firefox accepts a string instead of an object here, but only from version 51 onwards. In version 50, options must be an object.
- For backwards compatibility, the `options` parameter can be an object or a string with the custom element tag name, although the string version is deprecated.
- This browser only partially implements this feature
- This feature was removed in a later browser version (36)
- Only supported for `HTMLDocument`, not all `Document` objects.
- Incorrect behavior before Firefox 23.
- This browser only partially implements this feature
- This feature was removed in a later browser version (10.1)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (36)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (10.3)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (36)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (61)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (10.1)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (36)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (10.3)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (61)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (4)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (3.2)
- Only supported for `HTMLDocument`, not all `Document` objects.
- Before Edge 79, this method returns an `HTMLCollection`, not a `NodeList`.
- This browser only partially implements this feature
- This feature was removed in a later browser version (58)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (4)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (3.2)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (7)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (7)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (61)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (61)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (4)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (3.2)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (4)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (3.2)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (61)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (4)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (3.2)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (36)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (61)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (10.1)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (36)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (10.3)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (36)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (61)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (10.1)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (36)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (10.3)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (4)
- This feature was removed in a later browser version (3)
- Only supported for `HTMLDocument` and `XMLDocument`, but not `SVGDocument` objects.
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (3.2)
- This feature was removed in a later browser version (2)
- Only supported for `HTMLDocument` and `XMLDocument`, but not `SVGDocument` objects.
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (19)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (3)
- Only supported for `HTMLDocument`, not all `Document` objects.
- This browser only partially implements this feature
- This feature was removed in a later browser version (2)
- Only supported for `HTMLDocument`, not all `Document` objects.
- Before Chrome 50, this property was part of the deprecated child `DOMSettableTokenList` interface.
- Before Chrome Android 50, this property was part of the deprecated child `DOMSettableTokenList` interface.
- This browser only partially implements this feature
- This feature was removed in a later browser version (22)
- Not supported for SVG elements.
- This browser only partially implements this feature
- This feature was removed in a later browser version (16)
- Not supported for SVG elements.
- This browser only partially implements this feature
- This feature was removed in a later browser version (7)
- Not supported for SVG elements.
- This browser only partially implements this feature
- This feature was removed in a later browser version (25)
- Not supported for SVG elements.
- This browser only partially implements this feature
- This feature was removed in a later browser version (7)
- Not supported for SVG elements.
- This browser only partially implements this feature
- This feature was removed in a later browser version (22)
- Only supported for `HTMLElement`, not all `Element` objects, such as `SVGElement`.
- This browser only partially implements this feature
- This feature was removed in a later browser version (25)
- Only supported for `HTMLElement`, not all `Element` objects, such as `SVGElement`.
- Starting in Firefox 13, `null` is always returned instead of the empty string, as per the DOM4 specification. Previously, there were cases in which an empty string could be returned.
- Safari for iOS will modify the effective viewport based on the user zoom. This results in incorrect values whenever the user has zoomed.
- This browser only partially implements this feature
- This feature was removed in a later browser version (16)
- Only supported for `HTMLElement`, not all `Element` objects, such as `SVGElement`.
- Before Firefox 19, this method was returning a `NodeList`; it was then changed to reflect the change in the spec.
- Initially, this method was returning a `NodeList`; it was then changed to reflect the spec change.
- Before Firefox 19, this method was returning a `NodeList`; it was then changed to reflect the change in the spec.
- Initially, this method was returning a `NodeList`; it was then changed to reflect the spec change.
- Initially, this method was returning a `NodeList`; it was then changed to reflect the spec change.
- Initially, this method was returning a `NodeList`; it was then changed to reflect the spec change.
- Initially, this method was returning a `NodeList`; it was then changed to reflect the spec change.
- The behavior of `element.getElementsByTagNameNS` changed between Firefox 3.5 and Firefox 3.6. In Firefox 3.5 and before, this function would automatically case-fold any queries so that a search for "foo" would match "Foo" or "foo". In Firefox 3.6 and later this function is now case-sensitive so that a query for "foo" will only match "foo" and not "Foo". For more background on this, please see the comment from Henri Sivonen about the change. You can also look at the relevant part of the standard, which states which parts of the API are case-sensitive and which parts aren't.
- Before Firefox 19, this method was returning a `NodeList`; it was then changed to reflects the spec change.
- Initially, this method was returning a `NodeList`; it was then changed to reflect the spec change.
- Initially, this method was returning a `NodeList`; it was then changed to reflect the spec change.
- Initially, this method was returning a `NodeList`; it was then changed to reflect the spec change.
- Before Firefox 35, it was implemented on the `Node` interface.
- This browser only partially implements this feature
- This feature was removed in a later browser version (23)
- Only supported for `HTMLElement`, not all `Element` objects, such as `SVGElement`.
- This browser only partially implements this feature
- This feature was removed in a later browser version (25)
- Only supported for `HTMLElement`, not all `Element` objects, such as `SVGElement`.
- This browser only partially implements this feature
- This feature was removed in a later browser version (17)
- Only supported for `HTMLElement`, not all `Element` objects, such as `SVGElement`.
- This browser only partially implements this feature
- This feature was removed in a later browser version (17)
- Only supported for `HTMLElement`, not all `Element` objects, such as `SVGElement`.
- This browser only partially implements this feature
- This feature was removed in a later browser version (17)
- Only supported for `HTMLElement`, not all `Element` objects, such as `SVGElement`.
- Previously available under a different name: webkitMatchesSelector (4)
- Previously available under a different name: webkitMatchesSelector (12)
- Previously available under a different name: msMatchesSelector (12)
- This feature was removed in a later browser version (79)
- Previously available under a different name: webkitMatchesSelector (44)
- Previously available under a different name: mozMatchesSelector (3.6)
- Before Firefox 4, invalid selector strings caused false to be returned instead of throwing an exception.
- See bug 1119718 for removal.
- Previously available under a different name: webkitMatchesSelector (5)
- Previously available under a different name: webkitMatchesSelector (18)
- Previously available under a different name: webkitMatchesSelector (4.2)
- This function doesn't respect boolean attributes' default values. See bug 12087679.
- Returns a `ClientRectList` with `ClientRect` objects (which do not contain `x` and `y` properties) instead of `DOMRect` objects.
- This feature was removed in a later browser version (22)
- This feature was removed in a later browser version (34)
- Previously available under a different name: MozNamedAttrMap (22)
- WebKit and old versions of Blink incorrectly do not make `Node` inherit from `EventTarget`.
- WebKit and old versions of Blink incorrectly do not make `Node` inherit from `EventTarget`.
- WebKit and old versions of Blink incorrectly do not make `Node` inherit from `EventTarget`.
- WebKit and old versions of Blink incorrectly do not make `Node` inherit from `EventTarget`.
- This feature was removed in a later browser version (10)
- This feature was removed in a later browser version (9)
- The `ownerDocument` of doctype nodes (that is, nodes for which `Node.nodeType` is `Node.DOCUMENT_TYPE_NODE` or 10) is `null`.
- Before Chrome 30, the `offset` parameter was optional.
- The `offset` parameter is optional.
- Before Chrome Android 30, the `offset` parameter was optional.
- The `offset` parameter is optional.
- This browser only partially implements this feature
- This feature was removed in a later browser version (34)
- Implemented as an alias for `Document`.
- This browser only partially implements this feature
- This feature was removed in a later browser version (10)
- Implemented as an alias for `Document`.
- This browser only partially implements this feature
- This feature was removed in a later browser version (34)
- Implemented as an alias for `Document`.
- This browser only partially implements this feature
- This feature was removed in a later browser version (10)
- Implemented as an alias for `Document`.
Syntax
const el = document.createElement('div');
el.textContent = 'Hello';
el.classList.add('highlight');
document.body.appendChild(el); Live demo
Query and highlight
Use selectors to find matching cards and toggle a highlighted state.
Use cases
Responding to user input
Update text, attributes, classes, and structure when users click, type, or navigate through the interface.
State-driven UI changes
Show errors, reveal panels, and synchronize component state with what appears on screen.
Cautions
- Large unscoped DOM rewrites are fragile and can reset focus, state, or event bindings unexpectedly.
- Avoid mixing many one-off mutations when the UI would be clearer with a structured component model.
Accessibility
- When DOM updates change meaning or state, ensure screen reader users can perceive the result through text, focus, or live regions.
- Keep the reading and tab order stable unless there is a clear reason to change it.
Related links
Powered by web-features