From bc4a31ed0f80c99445eb3552d276fb8d04318f89 Mon Sep 17 00:00:00 2001 From: Bryan C Guner Date: Sun, 27 Feb 2022 21:44:33 +0000 Subject: [PATCH 1/4] -update --- notes/JS-DOC/displayname.md | 4 ++-- notes/JS-DOC/displaynames.md | 6 +++--- notes/JS-DOC/for...of.md | 14 +++++++++----- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/notes/JS-DOC/displayname.md b/notes/JS-DOC/displayname.md index 2dbb446c04..878e94def2 100644 --- a/notes/JS-DOC/displayname.md +++ b/notes/JS-DOC/displayname.md @@ -94,6 +94,6 @@ No ## See also -- [`Function.name`](name) +- [`Function.name`](name) -https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/displayName +https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/displayName diff --git a/notes/JS-DOC/displaynames.md b/notes/JS-DOC/displaynames.md index 7cb0b591e8..add717c3eb 100644 --- a/notes/JS-DOC/displaynames.md +++ b/notes/JS-DOC/displaynames.md @@ -99,7 +99,7 @@ To create an `Intl.DisplayNames` for a locale and get the display name for curre ## Specifications -
Specification
ECMAScript Internationalization API Specification (ECMAScript Internationalization API) +
Specification
ECMAScript Internationalization API Specification (ECMAScript Internationalization API)
#intl-displaynames-objects
@@ -236,6 +236,6 @@ No ## See also -- [`Intl`](../intl) +- [`Intl`](../intl) -
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames +https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames diff --git a/notes/JS-DOC/for...of.md b/notes/JS-DOC/for...of.md index fc10f4951f..b0ec4128de 100644 --- a/notes/JS-DOC/for...of.md +++ b/notes/JS-DOC/for...of.md @@ -257,7 +257,7 @@ This loop iterates and logs **values** that `iterable`, as an [iterable object]( ## Specifications -
Specification
ECMAScript Language Specification (ECMAScript) +
Specification
ECMAScript Language Specification (ECMAScript)
#sec-for-in-and-for-of-statements
@@ -346,10 +346,14 @@ No ## See also -- [`Array.prototype.forEach()`](../global_objects/array/foreach) -- [`Map.prototype.forEach()`](../global_objects/map/foreach) -- [`Object.entries()`](../global_objects/object/entries) – Useful when using `for...of` over an object. +- [`Array.prototype.forEach()`](../global_objects/array/foreach) + + +- [`Map.prototype.forEach()`](../global_objects/map/foreach) + + +- [`Object.entries()`](../global_objects/object/entries) – Useful when using `for...of` over an object. © 2005–2021 MDN contributors. Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later. -
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of +https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of From a8938ce25065d6f13a42805b93b82489c67d5398 Mon Sep 17 00:00:00 2001 From: Bryan C Guner Date: Sun, 27 Feb 2022 21:51:55 +0000 Subject: [PATCH 2/4] -update --- .../Add-site-search-w-algolia.md.md | 35 +- .../Adding-search-2-gatsby-site.md.md | 14 +- .../BasicWebDevelopmentEnvironmentSetup.md.md | 5 +- notes/BGOONZ_BLOG_2.0.wiki/DOM-standard.md.md | 5380 +- .../Data-Structures.md.md | 334 +- notes/BGOONZ_BLOG_2.0.wiki/Home.md | 18 +- .../Netlify-Injected-Content.md | 14265 ++-- notes/BGOONZ_BLOG_2.0.wiki/SEO.md.md | 149 +- .../BGOONZ_BLOG_2.0.wiki/STABLE_POINTS.md.md | 22 +- .../THINGS-TO-EMBED.md.md | 38 +- .../Technologies-Used.md.md | 2 +- notes/BGOONZ_BLOG_2.0.wiki/Todo.md.md | 1 + notes/BGOONZ_BLOG_2.0.wiki/_Footer.md | 30 +- notes/BGOONZ_BLOG_2.0.wiki/_Sidebar.md | 79 +- .../add-copy-to-code-blocks.md.md | 80 +- .../adding-mailing-list.md.md | 17 +- notes/BGOONZ_BLOG_2.0.wiki/ajax-starter.md.md | 11 +- notes/BGOONZ_BLOG_2.0.wiki/analytics.md.md | 3 +- .../anatomy-of-search-engine.md.md | 132 +- notes/BGOONZ_BLOG_2.0.wiki/awesome.md.md | 1258 +- notes/BGOONZ_BLOG_2.0.wiki/bookmarks.md.md | 5744 +- notes/BGOONZ_BLOG_2.0.wiki/broken-links.md.md | 404 +- notes/BGOONZ_BLOG_2.0.wiki/config-info.md.md | 6 +- .../configure-custom-domain.md.md | 19 +- .../contentauthoring.md.md | 77 +- .../custom-search-bar.md.md | 153 +- .../dependency-graph.md.md | 9 +- .../full-text-search-w-lunar.md.md | 82 +- .../github-actions-full-doc.md.md | 113 +- .../google-custom-search.md.md | 154 +- .../google-search-algo.md.md | 2 +- .../google-webmaster-guidelines.md.md | 44 +- notes/BGOONZ_BLOG_2.0.wiki/inject-4.md.md | 5 +- notes/BGOONZ_BLOG_2.0.wiki/inject5.md.md | 800 + .../injected-content-part2.md.md | 231 +- .../injected-js-part4.md.md | 3 +- .../BGOONZ_BLOG_2.0.wiki/injected-part3.md.md | 8 +- .../BGOONZ_BLOG_2.0.wiki/internal-links.md.md | 212 + notes/BGOONZ_BLOG_2.0.wiki/js-notes.md.md | 344 +- .../BGOONZ_BLOG_2.0.wiki/links-2-embed.md.md | 295 +- .../BGOONZ_BLOG_2.0.wiki/links-to-remember.md | 395 +- .../BGOONZ_BLOG_2.0.wiki/list-of-links.md.md | 523 + notes/BGOONZ_BLOG_2.0.wiki/netlify-tips.md.md | 53 +- notes/BGOONZ_BLOG_2.0.wiki/node-guide.md.md | 462 +- notes/BGOONZ_BLOG_2.0.wiki/node-js-docs.md.md | 58403 ++++++++++++++++ .../old-version-of-index.md.md | 580 +- .../optimize-vscode.md.md | 39 +- .../possibly-useful-snippets.md.md | 66 +- .../BGOONZ_BLOG_2.0.wiki/privacy-policy.md.md | 47 +- notes/BGOONZ_BLOG_2.0.wiki/random-stuff.md.md | 10 +- notes/BGOONZ_BLOG_2.0.wiki/random.md.md | 7 +- .../BGOONZ_BLOG_2.0.wiki/readfile-guide.md.md | 29 +- notes/BGOONZ_BLOG_2.0.wiki/ref-type.md | 50 +- .../search-engine-simulation.md.md | 260 +- notes/BGOONZ_BLOG_2.0.wiki/sitemap.md.md | 148 + notes/BGOONZ_BLOG_2.0.wiki/sourcecode.md.md | 85 +- .../stack-overflow-site-search.md.md | 11 +- .../BGOONZ_BLOG_2.0.wiki/tech-used-2021.md.md | 36 +- notes/BGOONZ_BLOG_2.0.wiki/tech-used.md.md | 137 +- ...tutorials-how-2-install-nodejs-n-npm.md.md | 345 + .../validation-report.md.md | 562 +- .../ways-to-improve-site.md.md | 3 +- notes/BGOONZ_BLOG_2.0.wiki/web-archive.md.md | 19 +- notes/BGOONZ_BLOG_2.0.wiki/webhooks.md.md | 61 +- .../wordpress-vs-headless-cms.md.md | 61 +- 65 files changed, 77289 insertions(+), 15681 deletions(-) create mode 100644 notes/BGOONZ_BLOG_2.0.wiki/Todo.md.md create mode 100644 notes/BGOONZ_BLOG_2.0.wiki/inject5.md.md create mode 100644 notes/BGOONZ_BLOG_2.0.wiki/internal-links.md.md create mode 100644 notes/BGOONZ_BLOG_2.0.wiki/node-js-docs.md.md create mode 100644 notes/BGOONZ_BLOG_2.0.wiki/sitemap.md.md create mode 100644 notes/BGOONZ_BLOG_2.0.wiki/tutorials-how-2-install-nodejs-n-npm.md.md diff --git a/notes/BGOONZ_BLOG_2.0.wiki/Add-site-search-w-algolia.md.md b/notes/BGOONZ_BLOG_2.0.wiki/Add-site-search-w-algolia.md.md index 24a55e5997..00bee4a488 100644 --- a/notes/BGOONZ_BLOG_2.0.wiki/Add-site-search-w-algolia.md.md +++ b/notes/BGOONZ_BLOG_2.0.wiki/Add-site-search-w-algolia.md.md @@ -1,10 +1,12 @@ -# Adding a Site Search to Your Stackbit Gatsby Site +Adding a Site Search to Your Stackbit Gatsby Site +================================================= There are a number of options for adding search to your Stackbit site built with Gatsby. There are some free options like [Lunr](https://lunrjs.com/) that are free and open source and can perform simple searches on pre-generated indexes. In this example, we'll use a service called [Algolia](https://www.algolia.com/) for the search API. Algolia is a service specifically geared towards search and thus has many more features. Algolia is a commercial offering, but it has a generous free tier. The example below was built with Stackbit. You can see the full project code at ). -## [](https://www.stackbit.com/docs/developer-guides/gatsby/site-search/#setting_up_algolia)Setting Up Algolia +[](https://www.stackbit.com/docs/developer-guides/gatsby/site-search/#setting_up_algolia)Setting Up Algolia +----------------------------------------------------------------------------------------------------------- You'll need to set up your account on Algolia and set up a project. You can skip the steps about setting up indices when creating your account - we'll take care of that via code. However, be sure to grab all your API keys from the Algolia dashboard as we'll need them later. @@ -120,22 +122,23 @@ const postQuery = `{ }`; const flatten = (arr) => - arr.map(({ node: { frontmatter, ...rest } }) => ({ - ...frontmatter, - ...rest - })); + arr.map(({ node: { frontmatter, ...rest } }) => ({ + ...frontmatter, + ...rest + })); const settings = { attributesToSnippet: [`excerpt:20`] }; const queries = [ - { - query: postQuery, - transformer: ({ data }) => flatten(data.posts.edges), - indexName: `Posts`, - settings - } + { + query: postQuery, + transformer: ({ data }) => flatten(data.posts.edges), + indexName: `Posts`, + settings + } ]; module.exports = queries; + ``` Copy @@ -148,7 +151,8 @@ We can now see the results when going into Algolia and browsing Indices. ![indices populated on Algolia dashboard](https://www.stackbit.com/docs/images/algolia-indices-sm.png) -## [](https://www.stackbit.com/docs/developer-guides/gatsby/site-search/#creating_the_search_ui)Creating the Search UI +[](https://www.stackbit.com/docs/developer-guides/gatsby/site-search/#creating_the_search_ui)Creating the Search UI +------------------------------------------------------------------------------------------------------------------- Now that our search indices are populated, let's display some results. To do this, we're going to use [React InstantSearch](https://github.com/algolia/react-instantsearch), which offers a search-as-you-type experience. It pretty much works out of the box using the [code they provide](https://www.algolia.com/doc/guides/building-search-ui/installation/react/). @@ -300,10 +304,11 @@ The result works as shown below. ![finished search results](https://www.stackbit.com/docs/images/finished-search.gif) -## [](https://www.stackbit.com/docs/developer-guides/gatsby/site-search/#deployment)Deployment +[](https://www.stackbit.com/docs/developer-guides/gatsby/site-search/#deployment)Deployment +------------------------------------------------------------------------------------------- When we're ready to deploy the search, we need to ensure that the environment variables we created are available when we deploy. On Netlify, all we need to do is go to Settings > Build & Deploy > Environment and add the necessary variables defined in our `.env` file to our deployment settings. ![Netlify environment variables](https://www.stackbit.com/docs/images/env-variables-sm.png) -We're all set! +We're all set! \ No newline at end of file diff --git a/notes/BGOONZ_BLOG_2.0.wiki/Adding-search-2-gatsby-site.md.md b/notes/BGOONZ_BLOG_2.0.wiki/Adding-search-2-gatsby-site.md.md index 68adeee8d8..c45501575b 100644 --- a/notes/BGOONZ_BLOG_2.0.wiki/Adding-search-2-gatsby-site.md.md +++ b/notes/BGOONZ_BLOG_2.0.wiki/Adding-search-2-gatsby-site.md.md @@ -1,4 +1,5 @@ -# Adding Search to Your Gatsby Site +Adding Search to Your Gatsby Site +================================= Brian Rinaldi --- July 01, 2020 @@ -10,7 +11,8 @@ Search is an important part of almost any site. Once you have a lot of content, In this post, we're going to explore adding search to a site built with Gatsby. We'll use a service called [Algolia](https://www.algolia.com/) for the search API. This is a commercial offering, but it has a generous free tier. The example site was built with Stackbit, though there's nothing in the code that we'll discuss that is Stackbit specific (for reference, you can see the full project code at ). Ok, enough intro...let's get coding. -## Setting Up Algolia +Setting Up Algolia +------------------ First things first, you'll need to set up your account on Algolia and set up a project. You can skip the steps about setting up indices as we'll take care of that via code. However, be sure to grab all your API keys from the Algolia dashboard as we'll need them later. @@ -155,7 +157,8 @@ We can now see the results when going into Algolia and browsing Indices. ![indices populated on Algolia dashboard](https://www.stackbit.com/images/1593607436-algolia-indices-sm.png) -## Creating the Search UI +Creating the Search UI +---------------------- Now that our search indices are populated, let's display some results. To do this, we're going to use [React InstantSearch](https://github.com/algolia/react-instantsearch), which offers a search-as-you-type experience. It pretty much works out of the box using the [code they provide](https://www.algolia.com/doc/guides/building-search-ui/installation/react/). @@ -313,7 +316,8 @@ The result works as shown below. ![](https://www.stackbit.com/images/gatsby-finished-search.png) -## Where to Go From Here +Where to Go From Here +--------------------- There's one more step that I should mention. We need to ensure that the environment variables we created are available when we deploy. On Netlify, all we need to do is go to Settings > Build & Deploy > Environment and add the necessary variables defined in our `.env` file to our deployment settings. @@ -321,4 +325,4 @@ There's one more step that I should mention. We need to ensure that the environm We're all set! -Obviously, this is just one way to implement the search. The [Gatsby documentation](https://www.gatsbyjs.org/docs/adding-search-with-algolia/) offers a similar but probably more flexible implementation. The [InstantSearch](https://www.algolia.com/doc/api-reference/widgets/instantsearch/react/) documentation also offers a ton of API and customization details with code samples to help you make the tools fit the needs of your specific site. In the end, implementing a search seems like a complicated task, but, thankfully, the tools and libraries available to us do a lot of the heavy lifting, making our jobs much easier. +Obviously, this is just one way to implement the search. The [Gatsby documentation](https://www.gatsbyjs.org/docs/adding-search-with-algolia/) offers a similar but probably more flexible implementation. The [InstantSearch](https://www.algolia.com/doc/api-reference/widgets/instantsearch/react/) documentation also offers a ton of API and customization details with code samples to help you make the tools fit the needs of your specific site. In the end, implementing a search seems like a complicated task, but, thankfully, the tools and libraries available to us do a lot of the heavy lifting, making our jobs much easier. \ No newline at end of file diff --git a/notes/BGOONZ_BLOG_2.0.wiki/BasicWebDevelopmentEnvironmentSetup.md.md b/notes/BGOONZ_BLOG_2.0.wiki/BasicWebDevelopmentEnvironmentSetup.md.md index 1f0f4a5b93..bf21ab5a88 100644 --- a/notes/BGOONZ_BLOG_2.0.wiki/BasicWebDevelopmentEnvironmentSetup.md.md +++ b/notes/BGOONZ_BLOG_2.0.wiki/BasicWebDevelopmentEnvironmentSetup.md.md @@ -1,8 +1,9 @@ -# Basic Web Development Environment Setup +Basic Web Development Environment Setup +======================================= Windows Subsystem for Linux (WSL) and Ubuntu ---- +------------------------------------------------------------------------ ### Basic Web Development Environment Setup diff --git a/notes/BGOONZ_BLOG_2.0.wiki/DOM-standard.md.md b/notes/BGOONZ_BLOG_2.0.wiki/DOM-standard.md.md index 6131fcad85..8a0b0f4875 100644 --- a/notes/BGOONZ_BLOG_2.0.wiki/DOM-standard.md.md +++ b/notes/BGOONZ_BLOG_2.0.wiki/DOM-standard.md.md @@ -1,11 +1,10 @@ + # DOM Standard > ## Excerpt -> > This specification depends on the Infra Standard. [INFRA] --- - ## 1\. Infrastructure[](https://dom.spec.whatwg.org/#infrastructure) This specification depends on the Infra Standard. [\[INFRA\]](https://dom.spec.whatwg.org/#biblio-infra) @@ -53,8 +52,11 @@ The index of an object is its number of [preceding](https://dom.spec.whatwg.org/ The ordered set parser takes a string input and then runs these steps: 1. Let inputTokens be the result of [splitting input on ASCII whitespace](https://infra.spec.whatwg.org/#split-on-ascii-whitespace). + 2. Let tokens be a new [ordered set](https://infra.spec.whatwg.org/#ordered-set). + 3. [For each](https://infra.spec.whatwg.org/#list-iterate) token in inputTokens, [append](https://infra.spec.whatwg.org/#set-append) token to tokens. + 4. Return tokens. The ordered set serializer takes a set and returns the [concatenation](https://infra.spec.whatwg.org/#string-concatenate) of set using U+0020 SPACE. @@ -64,8 +66,11 @@ The ordered set serializer takes a set and returns the [concatenation](https://i To scope-match a selectors string selectors against a node, run these steps: 1. Let s be the result of [parse a selector](https://drafts.csswg.org/selectors-4/#parse-a-selector) selectors. [\[SELECTORS4\]](https://dom.spec.whatwg.org/#biblio-selectors4) + 2. If s is failure, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 3. Return the result of [match a selector against a tree](https://drafts.csswg.org/selectors-4/#match-a-selector-against-a-tree) with s and node’s [root](https://dom.spec.whatwg.org/#concept-tree-root) using [scoping root](https://drafts.csswg.org/selectors-4/#scoping-root) node. [\[SELECTORS4\]](https://dom.spec.whatwg.org/#biblio-selectors4). + Support for namespaces within selectors is not planned and will not be added. @@ -76,15 +81,25 @@ To validate a qualifiedName, [throw](https://webidl.spec.whatwg.org/#dfn-throw) To validate and extract a namespace and qualifiedName, run these steps: 1. If namespace is the empty string, then set it to null. + 2. [Validate](https://dom.spec.whatwg.org/#validate) qualifiedName. + 3. Let prefix be null. + 4. Let localName be qualifiedName. + 5. If qualifiedName contains a U+003A (:), then [strictly split](https://infra.spec.whatwg.org/#strictly-split) the string on it and set prefix to the part before and localName to the part after. + 6. If prefix is non-null and namespace is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NamespaceError](https://webidl.spec.whatwg.org/#namespaceerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 7. If prefix is "`xml`" and namespace is not the [XML namespace](https://infra.spec.whatwg.org/#xml-namespace), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NamespaceError](https://webidl.spec.whatwg.org/#namespaceerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 8. If either qualifiedName or prefix is "`xmlns`" and namespace is not the [XMLNS namespace](https://infra.spec.whatwg.org/#xmlns-namespace), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NamespaceError](https://webidl.spec.whatwg.org/#namespaceerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 9. If namespace is the [XMLNS namespace](https://infra.spec.whatwg.org/#xmlns-namespace) and neither qualifiedName nor prefix is "`xmlns`", then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NamespaceError](https://webidl.spec.whatwg.org/#namespaceerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. -10. Return namespace, prefix, and localName. + +10. Return namespace, prefix, and localName. + ## 2\. Events[](https://dom.spec.whatwg.org/#events) @@ -95,8 +110,8 @@ Throughout the web platform [events](https://dom.spec.whatwg.org/#concept-event) obj.addEventListener("load", imgFetched) function imgFetched(ev) { -// great success -… + // great success + … } [Event listeners](https://dom.spec.whatwg.org/#concept-event-listener) can be removed by utilizing the `[removeEventListener()](https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener)` method, passing the same arguments. @@ -117,8 +132,8 @@ obj.dispatchEvent(event) Apart from signaling, [events](https://dom.spec.whatwg.org/#concept-event) are sometimes also used to let an application control what happens next in an operation. For instance as part of form submission an [event](https://dom.spec.whatwg.org/#concept-event) whose `[type](https://dom.spec.whatwg.org/#dom-event-type)` attribute value is "`submit`" is [dispatched](https://dom.spec.whatwg.org/#concept-event-dispatch). If this [event](https://dom.spec.whatwg.org/#concept-event)’s `[preventDefault()](https://dom.spec.whatwg.org/#dom-event-preventdefault)` method is invoked, form submission will be terminated. Applications who wish to make use of this functionality through [events](https://dom.spec.whatwg.org/#concept-event) [dispatched](https://dom.spec.whatwg.org/#concept-event-dispatch) by the application (synthetic events) can make use of the return value of the `[dispatchEvent()](https://dom.spec.whatwg.org/#dom-eventtarget-dispatchevent)` method: if(obj.dispatchEvent(event)) { -// event was not canceled, time for some magic -… + // event was not canceled, time for some magic + … } When an [event](https://dom.spec.whatwg.org/#concept-event) is [dispatched](https://dom.spec.whatwg.org/#concept-event-dispatch) to an object that [participates](https://dom.spec.whatwg.org/#concept-tree-participate) in a [tree](https://dom.spec.whatwg.org/#concept-tree) (e.g., an [element](https://dom.spec.whatwg.org/#concept-element)), it can reach [event listeners](https://dom.spec.whatwg.org/#concept-event-listener) on that object’s [ancestors](https://dom.spec.whatwg.org/#concept-tree-ancestor) too. Effectively, all the object’s [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) [event listeners](https://dom.spec.whatwg.org/#concept-event-listener) whose [capture](https://dom.spec.whatwg.org/#event-listener-capture) is true are invoked, in [tree order](https://dom.spec.whatwg.org/#concept-tree-order). And then, if [event](https://dom.spec.whatwg.org/#concept-event)’s `[bubbles](https://dom.spec.whatwg.org/#dom-event-bubbles)` is true, all the object’s [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) [event listeners](https://dom.spec.whatwg.org/#concept-event-listener) whose [capture](https://dom.spec.whatwg.org/#event-listener-capture) is false are invoked, now in reverse [tree order](https://dom.spec.whatwg.org/#concept-tree-order). @@ -126,88 +141,87 @@ When an [event](https://dom.spec.whatwg.org/#concept-event) is [dispatched](http Let’s look at an example of how [events](https://dom.spec.whatwg.org/#concept-event) work in a [tree](https://dom.spec.whatwg.org/#concept-tree): - - -Boring example - - -Hello world! - -function test(e) { -debug(e.target, e.currentTarget, e.eventPhase) -} -document.addEventListener("hey", test, {capture: true}) -document.body.addEventListener("hey", test) -var ev \= new Event("hey", {bubbles:true}) -document.getElementById("x").dispatchEvent(ev) - - + + Boring example + + + Hello world! + + function test(e) { + debug(e.target, e.currentTarget, e.eventPhase) + } + document.addEventListener("hey", test, {capture: true}) + document.body.addEventListener("hey", test) + var ev \= new Event("hey", {bubbles:true}) + document.getElementById("x").dispatchEvent(ev) + + The `debug` function will be invoked twice. Each time the [event](https://dom.spec.whatwg.org/#concept-event)’s `[target](https://dom.spec.whatwg.org/#dom-event-target)` attribute value will be the `span` [element](https://dom.spec.whatwg.org/#concept-element). The first time `[currentTarget](https://dom.spec.whatwg.org/#dom-event-currenttarget)` attribute’s value will be the [document](https://dom.spec.whatwg.org/#concept-document), the second time the `body` [element](https://dom.spec.whatwg.org/#concept-element). `[eventPhase](https://dom.spec.whatwg.org/#dom-event-eventphase)` attribute’s value switches from `[CAPTURING_PHASE](https://dom.spec.whatwg.org/#dom-event-capturing_phase)` to `[BUBBLING_PHASE](https://dom.spec.whatwg.org/#dom-event-bubbling_phase)`. If an [event listener](https://dom.spec.whatwg.org/#concept-event-listener) was registered for the `span` [element](https://dom.spec.whatwg.org/#concept-element), `[eventPhase](https://dom.spec.whatwg.org/#dom-event-eventphase)` attribute’s value would have been `[AT_TARGET](https://dom.spec.whatwg.org/#dom-event-at_target)`. ### 2.2. Interface `[Event](https://dom.spec.whatwg.org/#event)`[](https://dom.spec.whatwg.org/#interface-event) -[Event](https://developer.mozilla.org/en-US/docs/Web/API/Event 'The Event interface represents an event which takes place in the DOM.') +[Event](https://developer.mozilla.org/en-US/docs/Web/API/Event "The Event interface represents an event which takes place in the DOM.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera4+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ ---- +___ Node.js14.5.0+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=(Window,Worker,AudioWorklet)\] interface `Event` { -`constructor`([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `type`[](https://dom.spec.whatwg.org/#dom-event-event-type-eventinitdict-type), optional [EventInit](https://dom.spec.whatwg.org/#dictdef-eventinit) `eventInitDict`[](https://dom.spec.whatwg.org/#dom-event-event-type-eventinitdict-eventinitdict) = {}); - -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [type](https://dom.spec.whatwg.org/#dom-event-type); -readonly attribute [EventTarget](https://dom.spec.whatwg.org/#eventtarget)? [target](https://dom.spec.whatwg.org/#dom-event-target); -readonly attribute [EventTarget](https://dom.spec.whatwg.org/#eventtarget)? [srcElement](https://dom.spec.whatwg.org/#dom-event-srcelement); // legacy -readonly attribute [EventTarget](https://dom.spec.whatwg.org/#eventtarget)? [currentTarget](https://dom.spec.whatwg.org/#dom-event-currenttarget); -[sequence](https://webidl.spec.whatwg.org/#idl-sequence)<[EventTarget](https://dom.spec.whatwg.org/#eventtarget)\> [composedPath](https://dom.spec.whatwg.org/#dom-event-composedpath)(); - -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [NONE](https://dom.spec.whatwg.org/#dom-event-none) = 0; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [CAPTURING_PHASE](https://dom.spec.whatwg.org/#dom-event-capturing_phase) = 1; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [AT_TARGET](https://dom.spec.whatwg.org/#dom-event-at_target) = 2; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [BUBBLING_PHASE](https://dom.spec.whatwg.org/#dom-event-bubbling_phase) = 3; -readonly attribute [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [eventPhase](https://dom.spec.whatwg.org/#dom-event-eventphase); - -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [stopPropagation](https://dom.spec.whatwg.org/#dom-event-stoppropagation)(); -attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [cancelBubble](https://dom.spec.whatwg.org/#dom-event-cancelbubble); // legacy alias of .stopPropagation() -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [stopImmediatePropagation](https://dom.spec.whatwg.org/#dom-event-stopimmediatepropagation)(); - -readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [bubbles](https://dom.spec.whatwg.org/#dom-event-bubbles); -readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [cancelable](https://dom.spec.whatwg.org/#dom-event-cancelable); -attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [returnValue](https://dom.spec.whatwg.org/#dom-event-returnvalue); // legacy -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [preventDefault](https://dom.spec.whatwg.org/#dom-event-preventdefault)(); -readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [defaultPrevented](https://dom.spec.whatwg.org/#dom-event-defaultprevented); -readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [composed](https://dom.spec.whatwg.org/#dom-event-composed); - -\[[LegacyUnforgeable](https://webidl.spec.whatwg.org/#LegacyUnforgeable)\] readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [isTrusted](https://dom.spec.whatwg.org/#dom-event-istrusted); -readonly attribute [DOMHighResTimeStamp](https://w3c.github.io/hr-time/#dom-domhighrestimestamp) [timeStamp](https://dom.spec.whatwg.org/#dom-event-timestamp); - -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [initEvent](https://dom.spec.whatwg.org/#dom-event-initevent)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `type`[](https://dom.spec.whatwg.org/#dom-event-initevent-type-bubbles-cancelable-type), optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `bubbles`[](https://dom.spec.whatwg.org/#dom-event-initevent-type-bubbles-cancelable-bubbles) = false, optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `cancelable`[](https://dom.spec.whatwg.org/#dom-event-initevent-type-bubbles-cancelable-cancelable) = false); // legacy + `constructor`([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `type`[](https://dom.spec.whatwg.org/#dom-event-event-type-eventinitdict-type), optional [EventInit](https://dom.spec.whatwg.org/#dictdef-eventinit) `eventInitDict`[](https://dom.spec.whatwg.org/#dom-event-event-type-eventinitdict-eventinitdict) = {}); + + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [type](https://dom.spec.whatwg.org/#dom-event-type); + readonly attribute [EventTarget](https://dom.spec.whatwg.org/#eventtarget)? [target](https://dom.spec.whatwg.org/#dom-event-target); + readonly attribute [EventTarget](https://dom.spec.whatwg.org/#eventtarget)? [srcElement](https://dom.spec.whatwg.org/#dom-event-srcelement); // legacy + readonly attribute [EventTarget](https://dom.spec.whatwg.org/#eventtarget)? [currentTarget](https://dom.spec.whatwg.org/#dom-event-currenttarget); + [sequence](https://webidl.spec.whatwg.org/#idl-sequence)<[EventTarget](https://dom.spec.whatwg.org/#eventtarget)\> [composedPath](https://dom.spec.whatwg.org/#dom-event-composedpath)(); + + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [NONE](https://dom.spec.whatwg.org/#dom-event-none) = 0; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [CAPTURING\_PHASE](https://dom.spec.whatwg.org/#dom-event-capturing_phase) = 1; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [AT\_TARGET](https://dom.spec.whatwg.org/#dom-event-at_target) = 2; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [BUBBLING\_PHASE](https://dom.spec.whatwg.org/#dom-event-bubbling_phase) = 3; + readonly attribute [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [eventPhase](https://dom.spec.whatwg.org/#dom-event-eventphase); + + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [stopPropagation](https://dom.spec.whatwg.org/#dom-event-stoppropagation)(); + attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [cancelBubble](https://dom.spec.whatwg.org/#dom-event-cancelbubble); // legacy alias of .stopPropagation() + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [stopImmediatePropagation](https://dom.spec.whatwg.org/#dom-event-stopimmediatepropagation)(); + + readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [bubbles](https://dom.spec.whatwg.org/#dom-event-bubbles); + readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [cancelable](https://dom.spec.whatwg.org/#dom-event-cancelable); + attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [returnValue](https://dom.spec.whatwg.org/#dom-event-returnvalue); // legacy + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [preventDefault](https://dom.spec.whatwg.org/#dom-event-preventdefault)(); + readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [defaultPrevented](https://dom.spec.whatwg.org/#dom-event-defaultprevented); + readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [composed](https://dom.spec.whatwg.org/#dom-event-composed); + + \[[LegacyUnforgeable](https://webidl.spec.whatwg.org/#LegacyUnforgeable)\] readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [isTrusted](https://dom.spec.whatwg.org/#dom-event-istrusted); + readonly attribute [DOMHighResTimeStamp](https://w3c.github.io/hr-time/#dom-domhighrestimestamp) [timeStamp](https://dom.spec.whatwg.org/#dom-event-timestamp); + + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [initEvent](https://dom.spec.whatwg.org/#dom-event-initevent)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `type`[](https://dom.spec.whatwg.org/#dom-event-initevent-type-bubbles-cancelable-type), optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `bubbles`[](https://dom.spec.whatwg.org/#dom-event-initevent-type-bubbles-cancelable-bubbles) = false, optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `cancelable`[](https://dom.spec.whatwg.org/#dom-event-initevent-type-bubbles-cancelable-cancelable) = false); // legacy }; dictionary `EventInit` { -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `bubbles`[](https://dom.spec.whatwg.org/#dom-eventinit-bubbles) = false; -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `cancelable`[](https://dom.spec.whatwg.org/#dom-eventinit-cancelable) = false; -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `composed`[](https://dom.spec.whatwg.org/#dom-eventinit-composed) = false; + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `bubbles`[](https://dom.spec.whatwg.org/#dom-eventinit-bubbles) = false; + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `cancelable`[](https://dom.spec.whatwg.org/#dom-eventinit-cancelable) = false; + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `composed`[](https://dom.spec.whatwg.org/#dom-eventinit-composed) = false; }; An `[Event](https://dom.spec.whatwg.org/#event)` object is simply named an event. It allows for signaling that something has occurred, e.g., that an image has completed downloading. @@ -226,25 +240,25 @@ The [touch target list](https://dom.spec.whatwg.org/#event-touch-target-list) is An [event](https://dom.spec.whatwg.org/#concept-event) has an associated path. A [path](https://dom.spec.whatwg.org/#event-path) is a [list](https://infra.spec.whatwg.org/#list) of [structs](https://infra.spec.whatwg.org/#struct). Each [struct](https://infra.spec.whatwg.org/#struct) consists of an invocation target (an `[EventTarget](https://dom.spec.whatwg.org/#eventtarget)` object), an invocation-target-in-shadow-tree (a boolean), a shadow-adjusted target (a [potential event target](https://dom.spec.whatwg.org/#potential-event-target)), a (a [potential event target](https://dom.spec.whatwg.org/#potential-event-target)), a touch target list (a [list](https://infra.spec.whatwg.org/#list) of [potential event targets](https://dom.spec.whatwg.org/#potential-event-target)), a root-of-closed-tree (a boolean), and a slot-in-closed-tree (a boolean). A [path](https://dom.spec.whatwg.org/#event-path) is initially the empty list. -[Event/Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event 'The Event() constructor creates a new Event object. An event created in this way is called a synthetic event, as opposed to an event fired by the browser, and can be dispatched by a script.') +[Event/Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event "The Event() constructor creates a new Event object. An event created in this way is called a synthetic event, as opposed to an event fired by the browser, and can be dispatched by a script.") In all current engines. Firefox11+Safari6+Chrome15+ ---- +___ Opera11.6+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android14+iOS Safari6+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile12+ ---- +___ Node.js15.0.0+ @@ -258,75 +272,75 @@ In all current engines. Firefox1.5+Safari1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ ---- +___ Node.js14.5.0+ -`` event . `[type](https://dom.spec.whatwg.org/#dom-event-type)` `` +``event . `[type](https://dom.spec.whatwg.org/#dom-event-type)` `` Returns the type of event, e.g. "`click`", "`hashchange`", or "`submit`". -[Event/target](https://developer.mozilla.org/en-US/docs/Web/API/Event/target 'The read-only target property of the Event interface is a reference to the object onto which the event was dispatched. It is different from Event.currentTarget when the event handler is called during the bubbling or capturing phase of the event.') +[Event/target](https://developer.mozilla.org/en-US/docs/Web/API/Event/target "The read-only target property of the Event interface is a reference to the object onto which the event was dispatched. It is different from Event.currentTarget when the event handler is called during the bubbling or capturing phase of the event.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ ---- +___ Node.js14.5.0+ -`` event . `[target](https://dom.spec.whatwg.org/#dom-event-target)` `` +``event . `[target](https://dom.spec.whatwg.org/#dom-event-target)` `` Returns the object to which event is [dispatched](https://dom.spec.whatwg.org/#concept-event-dispatch) (its [target](https://dom.spec.whatwg.org/#event-target)). -[Event/currentTarget](https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget 'The currentTarget read-only property of the Event interface identifies the current target for the event, as the event traverses the DOM. It always refers to the element to which the event handler has been attached, as opposed to Event.target, which identifies the element on which the event occurred and which may be its descendant.') +[Event/currentTarget](https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget "The currentTarget read-only property of the Event interface identifies the current target for the event, as the event traverses the DOM. It always refers to the element to which the event handler has been attached, as opposed to Event.target, which identifies the element on which the event occurred and which may be its descendant.") In all current engines. Firefox1+Safari10+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari10+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ ---- +___ Node.js14.5.0+ -`` event . `[currentTarget](https://dom.spec.whatwg.org/#dom-event-currenttarget)` `` +``event . `[currentTarget](https://dom.spec.whatwg.org/#dom-event-currenttarget)` `` Returns the object whose [event listener](https://dom.spec.whatwg.org/#concept-event-listener)’s [callback](https://dom.spec.whatwg.org/#event-listener-callback) is currently being invoked. @@ -336,71 +350,71 @@ In all current engines. Firefox52+Safari10+Chrome53+ ---- +___ Opera40+Edge79+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android52+iOS Safari10+Chrome for Android53+Android WebView53+Samsung Internet6.0+Opera Mobile41+ ---- +___ Node.js14.5.0+ -`` event . `[composedPath()](https://dom.spec.whatwg.org/#dom-event-composedpath)` `` +``event . `[composedPath()](https://dom.spec.whatwg.org/#dom-event-composedpath)` `` Returns the [invocation target](https://dom.spec.whatwg.org/#event-path-invocation-target) objects of event’s [path](https://dom.spec.whatwg.org/#event-path) (objects on which listeners will be invoked), except for any [nodes](https://dom.spec.whatwg.org/#concept-node) in [shadow trees](https://dom.spec.whatwg.org/#concept-shadow-tree) of which the [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root)’s [mode](https://dom.spec.whatwg.org/#shadowroot-mode) is "`closed`" that are not reachable from event’s `[currentTarget](https://dom.spec.whatwg.org/#dom-event-currenttarget)`. -[Event/eventPhase](https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase 'The eventPhase read-only property of the Event interface indicates which phase of the event flow is currently being evaluated.') +[Event/eventPhase](https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase "The eventPhase read-only property of the Event interface indicates which phase of the event flow is currently being evaluated.") In all current engines. Firefox1.5+Safari4+Chrome45+ ---- +___ Opera32+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android45+Android WebView45+Samsung Internet5.0+Opera Mobile32+ ---- +___ Node.js14.5.0+ -`` event . `[eventPhase](https://dom.spec.whatwg.org/#dom-event-eventphase)` `` +``event . `[eventPhase](https://dom.spec.whatwg.org/#dom-event-eventphase)` `` Returns the [event](https://dom.spec.whatwg.org/#concept-event)’s phase, which is one of `[NONE](https://dom.spec.whatwg.org/#dom-event-none)`, `[CAPTURING_PHASE](https://dom.spec.whatwg.org/#dom-event-capturing_phase)`, `[AT_TARGET](https://dom.spec.whatwg.org/#dom-event-at_target)`, and `[BUBBLING_PHASE](https://dom.spec.whatwg.org/#dom-event-bubbling_phase)`. -[Event/stopPropagation](https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation 'The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases. It does not, however, prevent any default behaviors from occurring; for instance, clicks on links are still processed. If you want to stop those behaviors, see the preventDefault() method. It also does not prevent immediate propagation to other event-handlers. If you want to stop those, see stopImmediatePropagation().') +[Event/stopPropagation](https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation "The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases. It does not, however, prevent any default behaviors from occurring; for instance, clicks on links are still processed. If you want to stop those behaviors, see the preventDefault() method. It also does not prevent immediate propagation to other event-handlers. If you want to stop those, see stopImmediatePropagation().") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ ---- +___ Node.js14.5.0+ @@ -408,25 +422,25 @@ Node.js14.5.0+ When [dispatched](https://dom.spec.whatwg.org/#concept-event-dispatch) in a [tree](https://dom.spec.whatwg.org/#concept-tree), invoking this method prevents event from reaching any objects other than the current object. -[Event/stopImmediatePropagation](https://developer.mozilla.org/en-US/docs/Web/API/Event/stopImmediatePropagation 'The stopImmediatePropagation() method of the Event interface prevents other listeners of the same event from being called.') +[Event/stopImmediatePropagation](https://developer.mozilla.org/en-US/docs/Web/API/Event/stopImmediatePropagation "The stopImmediatePropagation() method of the Event interface prevents other listeners of the same event from being called.") In all current engines. Firefox10+Safari5+Chrome6+ ---- +___ Opera15+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android10+iOS Safari5+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile14+ ---- +___ Node.js14.5.0+ @@ -434,77 +448,77 @@ Node.js14.5.0+ Invoking this method prevents event from reaching any registered [event listeners](https://dom.spec.whatwg.org/#concept-event-listener) after the current one finishes running and, when [dispatched](https://dom.spec.whatwg.org/#concept-event-dispatch) in a [tree](https://dom.spec.whatwg.org/#concept-tree), also prevents event from reaching any other objects. -[Event/bubbles](https://developer.mozilla.org/en-US/docs/Web/API/Event/bubbles 'The bubbles read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.') +[Event/bubbles](https://developer.mozilla.org/en-US/docs/Web/API/Event/bubbles "The bubbles read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.") In all current engines. Firefox1.5+Safari4+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile12.1+ ---- +___ Node.js14.5.0+ -`` event . `[bubbles](https://dom.spec.whatwg.org/#dom-event-bubbles)` `` +``event . `[bubbles](https://dom.spec.whatwg.org/#dom-event-bubbles)` `` Returns true or false depending on how event was initialized. True if event goes through its [target](https://dom.spec.whatwg.org/#event-target)’s [ancestors](https://dom.spec.whatwg.org/#concept-tree-ancestor) in reverse [tree order](https://dom.spec.whatwg.org/#concept-tree-order); otherwise false. -[Event/cancelable](https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelable 'The cancelable read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.') +[Event/cancelable](https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelable "The cancelable read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.") In all current engines. Firefox1.5+Safari4+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile12.1+ ---- +___ Node.js14.5.0+ -`` event . `[cancelable](https://dom.spec.whatwg.org/#dom-event-cancelable)` `` +``event . `[cancelable](https://dom.spec.whatwg.org/#dom-event-cancelable)` `` Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was [dispatched](https://dom.spec.whatwg.org/#concept-event-dispatch), can be canceled by invoking the `[preventDefault()](https://dom.spec.whatwg.org/#dom-event-preventdefault)` method. -[Event/preventDefault](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault 'The preventDefault() method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.') +[Event/preventDefault](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault "The preventDefault() method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ ---- +___ Node.js14.5.0+ @@ -512,107 +526,107 @@ Node.js14.5.0+ If invoked when the `[cancelable](https://dom.spec.whatwg.org/#dom-event-cancelable)` attribute value is true, and while executing a listener for the event with `[passive](https://dom.spec.whatwg.org/#dom-addeventlisteneroptions-passive)` set to false, signals to the operation that caused event to be [dispatched](https://dom.spec.whatwg.org/#concept-event-dispatch) that it needs to be canceled. -[Event/defaultPrevented](https://developer.mozilla.org/en-US/docs/Web/API/Event/defaultPrevented 'The defaultPrevented read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.') +[Event/defaultPrevented](https://developer.mozilla.org/en-US/docs/Web/API/Event/defaultPrevented "The defaultPrevented read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.") In all current engines. Firefox6+Safari5+Chrome18+ ---- +___ Opera11+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android6+iOS Safari5+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile11+ ---- +___ Node.js14.5.0+ -`` event . `[defaultPrevented](https://dom.spec.whatwg.org/#dom-event-defaultprevented)` `` +``event . `[defaultPrevented](https://dom.spec.whatwg.org/#dom-event-defaultprevented)` `` Returns true if `[preventDefault()](https://dom.spec.whatwg.org/#dom-event-preventdefault)` was invoked successfully to indicate cancelation; otherwise false. -[Event/composed](https://developer.mozilla.org/en-US/docs/Web/API/Event/composed 'The read-only composed property of the Event interface returns a boolean value which indicates whether or not the event will propagate across the shadow DOM boundary into the standard DOM.') +[Event/composed](https://developer.mozilla.org/en-US/docs/Web/API/Event/composed "The read-only composed property of the Event interface returns a boolean value which indicates whether or not the event will propagate across the shadow DOM boundary into the standard DOM.") In all current engines. Firefox52+Safari10+Chrome53+ ---- +___ Opera40+Edge79+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android52+iOS Safari10+Chrome for Android53+Android WebView53+Samsung Internet6.0+Opera Mobile41+ ---- +___ Node.js14.5.0+ -`` event . `[composed](https://dom.spec.whatwg.org/#dom-event-composed)` `` +``event . `[composed](https://dom.spec.whatwg.org/#dom-event-composed)` `` Returns true or false depending on how event was initialized. True if event invokes listeners past a `[ShadowRoot](https://dom.spec.whatwg.org/#shadowroot)` [node](https://dom.spec.whatwg.org/#concept-node) that is the [root](https://dom.spec.whatwg.org/#concept-tree-root) of its [target](https://dom.spec.whatwg.org/#event-target); otherwise false. -[Event/isTrusted](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted 'The isTrusted read-only property of the Event interface is a boolean value that is true when the event was generated by a user action, and false when the event was created or modified by a script or dispatched via EventTarget.dispatchEvent().') +[Event/isTrusted](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted "The isTrusted read-only property of the Event interface is a boolean value that is true when the event was generated by a user action, and false when the event was created or modified by a script or dispatched via EventTarget.dispatchEvent().") In all current engines. Firefox1.5+Safari10+Chrome46+ ---- +___ Opera33+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari10+Chrome for Android46+Android WebView46+Samsung Internet5.0+Opera Mobile33+ ---- +___ Node.js14.5.0+ -`` event . `[isTrusted](https://dom.spec.whatwg.org/#dom-event-istrusted)` `` +``event . `[isTrusted](https://dom.spec.whatwg.org/#dom-event-istrusted)` `` Returns true if event was [dispatched](https://dom.spec.whatwg.org/#concept-event-dispatch) by the user agent, and false otherwise. -[Event/timeStamp](https://developer.mozilla.org/en-US/docs/Web/API/Event/timeStamp 'The timeStamp read-only property of the Event interface returns the time (in milliseconds) at which the event was created.') +[Event/timeStamp](https://developer.mozilla.org/en-US/docs/Web/API/Event/timeStamp "The timeStamp read-only property of the Event interface returns the time (in milliseconds) at which the event was created.") In all current engines. Firefox1.5+Safari4+Chrome49+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android49+Android WebView49+Samsung Internet5.0+Opera Mobile36+ ---- +___ Node.js14.5.0+ -`` event . `[timeStamp](https://dom.spec.whatwg.org/#dom-event-timestamp)` `` +``event . `[timeStamp](https://dom.spec.whatwg.org/#dom-event-timestamp)` `` Returns the event’s timestamp as the number of milliseconds measured relative to the [time origin](https://w3c.github.io/hr-time/#dfn-time-origin). @@ -627,49 +641,69 @@ The `currentTarget` attribute must return the value it was initialized to. When The `composedPath()` method steps are: 1. Let composedPath be an empty [list](https://infra.spec.whatwg.org/#list). + 2. Let path be [this](https://webidl.spec.whatwg.org/#this)’s [path](https://dom.spec.whatwg.org/#event-path). + 3. If path [is empty](https://infra.spec.whatwg.org/#list-is-empty), then return composedPath. + 4. Let currentTarget be [this](https://webidl.spec.whatwg.org/#this)’s `[currentTarget](https://dom.spec.whatwg.org/#dom-event-currenttarget)` attribute value. + 5. [Append](https://infra.spec.whatwg.org/#list-append) currentTarget to composedPath. + 6. Let currentTargetIndex be 0. + 7. Let currentTargetHiddenSubtreeLevel be 0. + 8. Let index be path’s [size](https://infra.spec.whatwg.org/#list-size) − 1. + 9. While index is greater than or equal to 0: - + 1. If path\[index\]'s [root-of-closed-tree](https://dom.spec.whatwg.org/#event-path-root-of-closed-tree) is true, then increase currentTargetHiddenSubtreeLevel by 1. + 2. If path\[index\]'s [invocation target](https://dom.spec.whatwg.org/#event-path-invocation-target) is currentTarget, then set currentTargetIndex to index and [break](https://infra.spec.whatwg.org/#iteration-break). + 3. If path\[index\]'s [slot-in-closed-tree](https://dom.spec.whatwg.org/#event-path-slot-in-closed-tree) is true, then decrease currentTargetHiddenSubtreeLevel by 1. + 4. Decrease index by 1. - -10. Let currentHiddenLevel and maxHiddenLevel be currentTargetHiddenSubtreeLevel. - -11. Set index to currentTargetIndex − 1. - -12. While index is greater than or equal to 0: - -13. If path\[index\]'s [root-of-closed-tree](https://dom.spec.whatwg.org/#event-path-root-of-closed-tree) is true, then increase currentHiddenLevel by 1. -14. If currentHiddenLevel is less than or equal to maxHiddenLevel, then [prepend](https://infra.spec.whatwg.org/#list-prepend) path\[index\]'s [invocation target](https://dom.spec.whatwg.org/#event-path-invocation-target) to composedPath. -15. If path\[index\]'s [slot-in-closed-tree](https://dom.spec.whatwg.org/#event-path-slot-in-closed-tree) is true, then: - - 1. Decrease currentHiddenLevel by 1. - 2. If currentHiddenLevel is less than maxHiddenLevel, then set maxHiddenLevel to currentHiddenLevel. - -16. Decrease index by 1. -17. Set currentHiddenLevel and maxHiddenLevel to currentTargetHiddenSubtreeLevel. - -18. Set index to currentTargetIndex + 1. - -19. While index is less than path’s [size](https://infra.spec.whatwg.org/#list-size): - -20. If path\[index\]'s [slot-in-closed-tree](https://dom.spec.whatwg.org/#event-path-slot-in-closed-tree) is true, then increase currentHiddenLevel by 1. -21. If currentHiddenLevel is less than or equal to maxHiddenLevel, then [append](https://infra.spec.whatwg.org/#list-append) path\[index\]'s [invocation target](https://dom.spec.whatwg.org/#event-path-invocation-target) to composedPath. -22. If path\[index\]'s [root-of-closed-tree](https://dom.spec.whatwg.org/#event-path-root-of-closed-tree) is true, then: - - 1. Decrease currentHiddenLevel by 1. - 2. If currentHiddenLevel is less than maxHiddenLevel, then set maxHiddenLevel to currentHiddenLevel. - -23. Increase index by 1. -24. Return composedPath. + +10. Let currentHiddenLevel and maxHiddenLevel be currentTargetHiddenSubtreeLevel. + +11. Set index to currentTargetIndex − 1. + +12. While index is greater than or equal to 0: + + 1. If path\[index\]'s [root-of-closed-tree](https://dom.spec.whatwg.org/#event-path-root-of-closed-tree) is true, then increase currentHiddenLevel by 1. + + 2. If currentHiddenLevel is less than or equal to maxHiddenLevel, then [prepend](https://infra.spec.whatwg.org/#list-prepend) path\[index\]'s [invocation target](https://dom.spec.whatwg.org/#event-path-invocation-target) to composedPath. + + 3. If path\[index\]'s [slot-in-closed-tree](https://dom.spec.whatwg.org/#event-path-slot-in-closed-tree) is true, then: + + 1. Decrease currentHiddenLevel by 1. + + 2. If currentHiddenLevel is less than maxHiddenLevel, then set maxHiddenLevel to currentHiddenLevel. + + 4. Decrease index by 1. + +13. Set currentHiddenLevel and maxHiddenLevel to currentTargetHiddenSubtreeLevel. + +14. Set index to currentTargetIndex + 1. + +15. While index is less than path’s [size](https://infra.spec.whatwg.org/#list-size): + + 1. If path\[index\]'s [slot-in-closed-tree](https://dom.spec.whatwg.org/#event-path-slot-in-closed-tree) is true, then increase currentHiddenLevel by 1. + + 2. If currentHiddenLevel is less than or equal to maxHiddenLevel, then [append](https://infra.spec.whatwg.org/#list-append) path\[index\]'s [invocation target](https://dom.spec.whatwg.org/#event-path-invocation-target) to composedPath. + + 3. If path\[index\]'s [root-of-closed-tree](https://dom.spec.whatwg.org/#event-path-root-of-closed-tree) is true, then: + + 1. Decrease currentHiddenLevel by 1. + + 2. If currentHiddenLevel is less than maxHiddenLevel, then set maxHiddenLevel to currentHiddenLevel. + + 4. Increase index by 1. + +16. Return composedPath. + The `eventPhase` attribute must return the value it was initialized to, which must be one of the following: @@ -691,7 +725,7 @@ When an [event](https://dom.spec.whatwg.org/#concept-event) is [dispatched](http Initially the attribute must be initialized to `[NONE](https://dom.spec.whatwg.org/#dom-event-none)`. ---- +___ Each [event](https://dom.spec.whatwg.org/#concept-event) has the following associated flags that are all initially unset: @@ -707,25 +741,25 @@ The `stopPropagation()` method steps are to set [this](https://webidl.spec.whatw The `cancelBubble` getter steps are to return true if [this](https://webidl.spec.whatwg.org/#this)’s [stop propagation flag](https://dom.spec.whatwg.org/#stop-propagation-flag) is set; otherwise false. -[Event/cancelBubble](https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelBubble 'The cancelBubble property of the Event interface is deprecated. Use Event.stopPropagation() instead. Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details.') +[Event/cancelBubble](https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelBubble "The cancelBubble property of the Event interface is deprecated. Use Event.stopPropagation() instead. Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details.") In all current engines. Firefox53+Safari4+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android53+iOS Safari3+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile12.1+ ---- +___ Node.js14.5.0+ @@ -749,7 +783,7 @@ The `defaultPrevented` getter steps are to return true if [this](https://webidl. The `composed` getter steps are to return true if [this](https://webidl.spec.whatwg.org/#this)’s [composed flag](https://dom.spec.whatwg.org/#composed-flag) is set; otherwise false. ---- +___ The `isTrusted` attribute must return the value it was initialized to. When an [event](https://dom.spec.whatwg.org/#concept-event) is created the attribute must be initialized to false. @@ -757,29 +791,38 @@ The `isTrusted` attribute must return the value it was initialized to. When an [ The `timeStamp` attribute must return the value it was initialized to. ---- +___ To initialize an event, with type, bubbles, and cancelable, run these steps: 1. Set event’s [initialized flag](https://dom.spec.whatwg.org/#initialized-flag). + 2. Unset event’s [stop propagation flag](https://dom.spec.whatwg.org/#stop-propagation-flag), [stop immediate propagation flag](https://dom.spec.whatwg.org/#stop-immediate-propagation-flag), and [canceled flag](https://dom.spec.whatwg.org/#canceled-flag). + 3. Set event’s `[isTrusted](https://dom.spec.whatwg.org/#dom-event-istrusted)` attribute to false. + 4. Set event’s [target](https://dom.spec.whatwg.org/#event-target) to null. + 5. Set event’s `[type](https://dom.spec.whatwg.org/#dom-event-type)` attribute to type. + 6. Set event’s `[bubbles](https://dom.spec.whatwg.org/#dom-event-bubbles)` attribute to bubbles. + 7. Set event’s `[cancelable](https://dom.spec.whatwg.org/#dom-event-cancelable)` attribute to cancelable. + The `initEvent(type, bubbles, cancelable)` method steps are: 1. If [this](https://webidl.spec.whatwg.org/#this)’s [dispatch flag](https://dom.spec.whatwg.org/#dispatch-flag) is set, then return. + 2. [Initialize](https://dom.spec.whatwg.org/#concept-event-initialize) [this](https://webidl.spec.whatwg.org/#this) with type, bubbles, and cancelable. + `[initEvent()](https://dom.spec.whatwg.org/#dom-event-initevent)` is redundant with [event](https://dom.spec.whatwg.org/#concept-event) constructors and incapable of setting `[composed](https://dom.spec.whatwg.org/#dom-event-composed)`. It has to be supported for legacy content. ### 2.3. Legacy extensions to the `[Window](https://html.spec.whatwg.org/multipage/window-object.html#window)` interface[](https://dom.spec.whatwg.org/#interface-window-extensions) partial interface [Window](https://html.spec.whatwg.org/multipage/window-object.html#window) { -\[[Replaceable](https://webidl.spec.whatwg.org/#Replaceable)\] readonly attribute ([Event](https://dom.spec.whatwg.org/#event) or [undefined](https://webidl.spec.whatwg.org/#idl-undefined)) [event](https://dom.spec.whatwg.org/#dom-window-event); // legacy + \[[Replaceable](https://webidl.spec.whatwg.org/#Replaceable)\] readonly attribute ([Event](https://dom.spec.whatwg.org/#event) or [undefined](https://webidl.spec.whatwg.org/#idl-undefined)) [event](https://dom.spec.whatwg.org/#dom-window-event); // legacy }; Each `[Window](https://html.spec.whatwg.org/multipage/window-object.html#window)` object has an associated current event (undefined or an `[Event](https://dom.spec.whatwg.org/#event)` object). Unless stated otherwise it is undefined. @@ -790,54 +833,54 @@ Web developers are strongly encouraged to instead rely on the `[Event](https://d ### 2.4. Interface `[CustomEvent](https://dom.spec.whatwg.org/#customevent)`[](https://dom.spec.whatwg.org/#interface-customevent) -[CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent 'The CustomEvent interface represents events initialized by an application for any purpose.') +[CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent "The CustomEvent interface represents events initialized by an application for any purpose.") In all current engines. Firefox6+Safari5+Chrome15+ ---- +___ Opera11+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android6+iOS Safari5+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile11+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=(Window,Worker)\] interface `CustomEvent` : [Event](https://dom.spec.whatwg.org/#event) { -`constructor`([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `type`[](https://dom.spec.whatwg.org/#dom-customevent-customevent-type-eventinitdict-type), optional [CustomEventInit](https://dom.spec.whatwg.org/#dictdef-customeventinit) `eventInitDict`[](https://dom.spec.whatwg.org/#dom-customevent-customevent-type-eventinitdict-eventinitdict) = {}); + `constructor`([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `type`[](https://dom.spec.whatwg.org/#dom-customevent-customevent-type-eventinitdict-type), optional [CustomEventInit](https://dom.spec.whatwg.org/#dictdef-customeventinit) `eventInitDict`[](https://dom.spec.whatwg.org/#dom-customevent-customevent-type-eventinitdict-eventinitdict) = {}); -readonly attribute [any](https://webidl.spec.whatwg.org/#idl-any) [detail](https://dom.spec.whatwg.org/#dom-customevent-detail); + readonly attribute [any](https://webidl.spec.whatwg.org/#idl-any) [detail](https://dom.spec.whatwg.org/#dom-customevent-detail); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [initCustomEvent](https://dom.spec.whatwg.org/#dom-customevent-initcustomevent)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `type`[](https://dom.spec.whatwg.org/#dom-customevent-initcustomevent-type-bubbles-cancelable-detail-type), optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `bubbles`[](https://dom.spec.whatwg.org/#dom-customevent-initcustomevent-type-bubbles-cancelable-detail-bubbles) = false, optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `cancelable`[](https://dom.spec.whatwg.org/#dom-customevent-initcustomevent-type-bubbles-cancelable-detail-cancelable) = false, optional [any](https://webidl.spec.whatwg.org/#idl-any) `detail`[](https://dom.spec.whatwg.org/#dom-customevent-initcustomevent-type-bubbles-cancelable-detail-detail) = null); // legacy + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [initCustomEvent](https://dom.spec.whatwg.org/#dom-customevent-initcustomevent)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `type`[](https://dom.spec.whatwg.org/#dom-customevent-initcustomevent-type-bubbles-cancelable-detail-type), optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `bubbles`[](https://dom.spec.whatwg.org/#dom-customevent-initcustomevent-type-bubbles-cancelable-detail-bubbles) = false, optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `cancelable`[](https://dom.spec.whatwg.org/#dom-customevent-initcustomevent-type-bubbles-cancelable-detail-cancelable) = false, optional [any](https://webidl.spec.whatwg.org/#idl-any) `detail`[](https://dom.spec.whatwg.org/#dom-customevent-initcustomevent-type-bubbles-cancelable-detail-detail) = null); // legacy }; dictionary `CustomEventInit` : [EventInit](https://dom.spec.whatwg.org/#dictdef-eventinit) { -[any](https://webidl.spec.whatwg.org/#idl-any) `detail`[](https://dom.spec.whatwg.org/#dom-customeventinit-detail) = null; + [any](https://webidl.spec.whatwg.org/#idl-any) `detail`[](https://dom.spec.whatwg.org/#dom-customeventinit-detail) = null; }; [Events](https://dom.spec.whatwg.org/#concept-event) using the `[CustomEvent](https://dom.spec.whatwg.org/#customevent)` interface can be used to carry custom data. -[CustomEvent/CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent 'The CustomEvent() constructor creates a new CustomEvent.') +[CustomEvent/CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent "The CustomEvent() constructor creates a new CustomEvent.") In all current engines. Firefox11+Safari6+Chrome15+ ---- +___ Opera11.6+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android14+iOS Safari6+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile12+ @@ -845,25 +888,25 @@ Firefox for Android14+iOS Safari6+Chrome for Android18+Android WebView37+Samsung Works analogously to the constructor for `[Event](https://dom.spec.whatwg.org/#event)` except that the eventInitDict argument now allows for setting the `[detail](https://dom.spec.whatwg.org/#dom-customevent-detail)` attribute too. -[CustomEvent/detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail 'The detail readonly property of the CustomEvent interface returns any data passed when initializing the event.') +[CustomEvent/detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail "The detail readonly property of the CustomEvent interface returns any data passed when initializing the event.") In all current engines. Firefox11+Safari5+Chrome15+ ---- +___ Opera11.6+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android14+iOS Safari5+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile12+ -`` event . `[detail](https://dom.spec.whatwg.org/#dom-customevent-detail)` `` +``event . `[detail](https://dom.spec.whatwg.org/#dom-customevent-detail)` `` Returns any custom data event was created with. Typically used for synthetic events. @@ -872,8 +915,11 @@ The `detail` attribute must return the value it was initialized to. The `initCustomEvent(type, bubbles, cancelable, detail)` method steps are: 1. If [this](https://webidl.spec.whatwg.org/#this)’s [dispatch flag](https://dom.spec.whatwg.org/#dispatch-flag) is set, then return. + 2. [Initialize](https://dom.spec.whatwg.org/#concept-event-initialize) [this](https://webidl.spec.whatwg.org/#this) with type, bubbles, and cancelable. + 3. Set [this](https://webidl.spec.whatwg.org/#this)’s `[detail](https://dom.spec.whatwg.org/#dom-customevent-detail)` attribute to detail. + ### 2.5. Constructing events[](https://dom.spec.whatwg.org/#constructing-events) @@ -884,36 +930,47 @@ This construct can be used by `[Event](https://dom.spec.whatwg.org/#event)` subc When a constructor[](https://dom.spec.whatwg.org/#concept-event-constructor) of the `[Event](https://dom.spec.whatwg.org/#event)` interface, or of an interface that inherits from the `[Event](https://dom.spec.whatwg.org/#event)` interface, is invoked, these steps must be run, given the arguments type and eventInitDict: 1. Let event be the result of running the [inner event creation steps](https://dom.spec.whatwg.org/#inner-event-creation-steps) with this interface, null, now, and eventInitDict. + 2. Initialize event’s `[type](https://dom.spec.whatwg.org/#dom-event-type)` attribute to type. + 3. Return event. + To create an event using eventInterface, which must be either `[Event](https://dom.spec.whatwg.org/#event)` or an interface that inherits from it, and optionally given a [Realm](https://tc39.es/ecma262/#realm) realm, run these steps: 1. If realm is not given, then set it to null. + 2. Let dictionary be the result of [converting](https://webidl.spec.whatwg.org/#dfn-convert-ecmascript-to-idl-value) the JavaScript value undefined to the dictionary type accepted by eventInterface’s constructor. (This dictionary type will either be `[EventInit](https://dom.spec.whatwg.org/#dictdef-eventinit)` or a dictionary that inherits from it.) - + This does not work if members are required; see [whatwg/dom#600](https://github.com/whatwg/dom/issues/600). - + 3. Let event be the result of running the [inner event creation steps](https://dom.spec.whatwg.org/#inner-event-creation-steps) with eventInterface, realm, the time of the occurrence that the event is signaling, and dictionary. - + [](https://dom.spec.whatwg.org/#example-timestamp-initialization)In macOS the time of the occurrence for input actions is available via the `timestamp` property of `NSEvent` objects. - + 4. Initialize event’s `[isTrusted](https://dom.spec.whatwg.org/#dom-event-istrusted)` attribute to true. + 5. Return event. + [Create an event](https://dom.spec.whatwg.org/#concept-event-create) is meant to be used by other specifications which need to separately [create](https://dom.spec.whatwg.org/#concept-event-create) and [dispatch](https://dom.spec.whatwg.org/#concept-event-dispatch) events, instead of simply [firing](https://dom.spec.whatwg.org/#concept-event-fire) them. It ensures the event’s attributes are initialized to the correct defaults. The inner event creation steps, given an interface, realm, time, and dictionary, are as follows: 1. Let event be the result of creating a new object using eventInterface. If realm is non-null, then use that Realm; otherwise, use the default behavior defined in Web IDL. - + As of the time of this writing Web IDL does not yet define any default behavior; see [whatwg/webidl#135](https://github.com/whatwg/webidl/issues/135). - + 2. Set event’s [initialized flag](https://dom.spec.whatwg.org/#initialized-flag). + 3. Initialize event’s `[timeStamp](https://dom.spec.whatwg.org/#dom-event-timestamp)` attribute to the [relative high resolution coarse time](https://w3c.github.io/hr-time/#dfn-relative-high-resolution-coarse-time) given time and event’s [relevant global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global). + 4. [For each](https://infra.spec.whatwg.org/#map-iterate) member → value in dictionary, if event has an attribute whose [identifier](https://webidl.spec.whatwg.org/#dfn-identifier) is member, then initialize that attribute to value. + 5. Run the [event constructing steps](https://dom.spec.whatwg.org/#concept-event-constructor-ext) with event and dictionary. + 6. Return event. + ### 2.6. Defining event interfaces[](https://dom.spec.whatwg.org/#defining-event-interfaces) @@ -923,85 +980,85 @@ The `[CustomEvent](https://dom.spec.whatwg.org/#customevent)` interface can be u ### 2.7. Interface `[EventTarget](https://dom.spec.whatwg.org/#eventtarget)`[](https://dom.spec.whatwg.org/#interface-eventtarget) -[EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget 'The EventTarget interface is implemented by objects that can receive events and may have listeners for them. In other words, any target of events implements the three methods associated with this interface.') +[EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget "The EventTarget interface is implemented by objects that can receive events and may have listeners for them. In other words, any target of events implements the three methods associated with this interface.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ ---- +___ Node.js14.5.0+ -[EventListener/handleEvent](https://developer.mozilla.org/en-US/docs/Web/API/EventListener/handleEvent 'The EventListener method handleEvent() method is called by the user agent when an event is sent to the EventListener, in order to handle events that occur on an observed EventTarget.') +[EventListener/handleEvent](https://developer.mozilla.org/en-US/docs/Web/API/EventListener/handleEvent "The EventListener method handleEvent() method is called by the user agent when an event is sent to the EventListener, in order to handle events that occur on an observed EventTarget.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ -[EventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventListener 'The EventListener interface represents an object that can handle an event dispatched by an EventTarget object.') +[EventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventListener "The EventListener interface represents an object that can handle an event dispatched by an EventTarget object.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=(Window,Worker,AudioWorklet)\] interface `EventTarget` { -[constructor](https://dom.spec.whatwg.org/#dom-eventtarget-eventtarget)(); + [constructor](https://dom.spec.whatwg.org/#dom-eventtarget-eventtarget)(); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [addEventListener](https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `type`[](https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener-type-callback-options-type), [EventListener](https://dom.spec.whatwg.org/#callbackdef-eventlistener)? `callback`[](https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener-type-callback-options-callback), optional ([AddEventListenerOptions](https://dom.spec.whatwg.org/#dictdef-addeventlisteneroptions) or [boolean](https://webidl.spec.whatwg.org/#idl-boolean)) `options`[](https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener-type-callback-options-options) = {}); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [removeEventListener](https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `type`[](https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener-type-callback-options-type), [EventListener](https://dom.spec.whatwg.org/#callbackdef-eventlistener)? `callback`[](https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener-type-callback-options-callback), optional ([EventListenerOptions](https://dom.spec.whatwg.org/#dictdef-eventlisteneroptions) or [boolean](https://webidl.spec.whatwg.org/#idl-boolean)) `options`[](https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener-type-callback-options-options) = {}); -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [dispatchEvent](https://dom.spec.whatwg.org/#dom-eventtarget-dispatchevent)([Event](https://dom.spec.whatwg.org/#event) `event`[](https://dom.spec.whatwg.org/#dom-eventtarget-dispatchevent-event-event)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [addEventListener](https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `type`[](https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener-type-callback-options-type), [EventListener](https://dom.spec.whatwg.org/#callbackdef-eventlistener)? `callback`[](https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener-type-callback-options-callback), optional ([AddEventListenerOptions](https://dom.spec.whatwg.org/#dictdef-addeventlisteneroptions) or [boolean](https://webidl.spec.whatwg.org/#idl-boolean)) `options`[](https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener-type-callback-options-options) = {}); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [removeEventListener](https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `type`[](https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener-type-callback-options-type), [EventListener](https://dom.spec.whatwg.org/#callbackdef-eventlistener)? `callback`[](https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener-type-callback-options-callback), optional ([EventListenerOptions](https://dom.spec.whatwg.org/#dictdef-eventlisteneroptions) or [boolean](https://webidl.spec.whatwg.org/#idl-boolean)) `options`[](https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener-type-callback-options-options) = {}); + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [dispatchEvent](https://dom.spec.whatwg.org/#dom-eventtarget-dispatchevent)([Event](https://dom.spec.whatwg.org/#event) `event`[](https://dom.spec.whatwg.org/#dom-eventtarget-dispatchevent-event-event)); }; callback interface `EventListener` { -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) `handleEvent`[](https://dom.spec.whatwg.org/#dom-eventlistener-handleevent)([Event](https://dom.spec.whatwg.org/#event) `event`[](https://dom.spec.whatwg.org/#dom-eventlistener-handleevent-event-event)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) `handleEvent`[](https://dom.spec.whatwg.org/#dom-eventlistener-handleevent)([Event](https://dom.spec.whatwg.org/#event) `event`[](https://dom.spec.whatwg.org/#dom-eventlistener-handleevent-event-event)); }; dictionary `EventListenerOptions` { -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `capture` = false; + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `capture` = false; }; dictionary `AddEventListenerOptions` : [EventListenerOptions](https://dom.spec.whatwg.org/#dictdef-eventlisteneroptions) { -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `passive` = false; -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `once` = false; -[AbortSignal](https://dom.spec.whatwg.org/#abortsignal) `signal`; + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `passive` = false; + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `once` = false; + [AbortSignal](https://dom.spec.whatwg.org/#abortsignal) `signal`; }; An `[EventTarget](https://dom.spec.whatwg.org/#eventtarget)` object represents a target to which an [event](https://dom.spec.whatwg.org/#concept-event) can be [dispatched](https://dom.spec.whatwg.org/#concept-event-dispatch) when something has occurred. @@ -1032,25 +1089,25 @@ Each `[EventTarget](https://dom.spec.whatwg.org/#eventtarget)` object that has [ These algorithms only exist for checkbox and radio `[input](https://html.spec.whatwg.org/multipage/input.html#the-input-element)` elements and are not to be used for anything else. [\[HTML\]](https://dom.spec.whatwg.org/#biblio-html) -[EventTarget/EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/EventTarget 'The EventTarget() constructor creates a new EventTarget object instance.') +[EventTarget/EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/EventTarget "The EventTarget() constructor creates a new EventTarget object instance.") In all current engines. Firefox59+Safari14+Chrome64+ ---- +___ Opera51+Edge79+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android59+iOS Safari14+Chrome for Android64+Android WebView64+Samsung Internet9.0+Opera Mobile47+ ---- +___ Node.js15.0.0+ @@ -1058,25 +1115,25 @@ Node.js15.0.0+ Creates a new `[EventTarget](https://dom.spec.whatwg.org/#eventtarget)` object, which can be used by developers to [dispatch](https://dom.spec.whatwg.org/#concept-event-dispatch) and listen for [events](https://dom.spec.whatwg.org/#concept-event). -[EventTarget/addEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener 'The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.') +[EventTarget/addEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener "The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ ---- +___ Node.js14.5.0+ @@ -1096,25 +1153,25 @@ If an `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)` is passed for op The [event listener](https://dom.spec.whatwg.org/#concept-event-listener) is appended to target’s [event listener list](https://dom.spec.whatwg.org/#eventtarget-event-listener-list) and is not appended if it has the same [type](https://dom.spec.whatwg.org/#event-listener-type), [callback](https://dom.spec.whatwg.org/#event-listener-callback), and [capture](https://dom.spec.whatwg.org/#event-listener-capture). -[EventTarget/removeEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener 'The removeEventListener() method of the EventTarget interface removes from the target an event listener previously registered with EventTarget.addEventListener(). The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.') +[EventTarget/removeEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener "The removeEventListener() method of the EventTarget interface removes from the target an event listener previously registered with EventTarget.addEventListener(). The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ ---- +___ Node.js14.5.0+ @@ -1122,25 +1179,25 @@ Node.js14.5.0+ Removes the [event listener](https://dom.spec.whatwg.org/#concept-event-listener) in target’s [event listener list](https://dom.spec.whatwg.org/#eventtarget-event-listener-list) with the same type, callback, and options. -[EventTarget/dispatchEvent](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent 'The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().') +[EventTarget/dispatchEvent](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent "The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().") In all current engines. Firefox2+Safari3.1+Chrome4+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView4+Samsung Internet1.0+Opera Mobile10.1+ ---- +___ Node.js14.5.0+ @@ -1151,19 +1208,26 @@ Node.js14.5.0+ To flatten options, run these steps: 1. If options is a boolean, then return options. + 2. Return options\["`[capture](https://dom.spec.whatwg.org/#dom-eventlisteneroptions-capture)`"\]. + To flatten more options, run these steps: 1. Let capture be the result of [flattening](https://dom.spec.whatwg.org/#concept-flatten-options) options. + 2. Let once and passive be false. + 3. Let signal be null. + 4. If options is a [dictionary](https://webidl.spec.whatwg.org/#dfn-dictionary), then: - + 1. Set passive to options\["`[passive](https://dom.spec.whatwg.org/#dom-addeventlisteneroptions-passive)`"\] and once to options\["`[once](https://dom.spec.whatwg.org/#dom-addeventlisteneroptions-once)`"\]. + 2. If options\["`[signal](https://dom.spec.whatwg.org/#dom-addeventlisteneroptions-signal)`"\] [exists](https://infra.spec.whatwg.org/#map-exists), then set signal to options\["`[signal](https://dom.spec.whatwg.org/#dom-addeventlisteneroptions-signal)`"\]. - + 5. Return capture, passive, once, and signal. + The `new EventTarget()` constructor steps are to do nothing. @@ -1174,11 +1238,15 @@ In the future we could allow custom [get the parent](https://dom.spec.whatwg.org To add an event listener, given an `[EventTarget](https://dom.spec.whatwg.org/#eventtarget)` object eventTarget and an [event listener](https://dom.spec.whatwg.org/#concept-event-listener) listener, run these steps: 1. If eventTarget is a `[ServiceWorkerGlobalScope](https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope)` object, its [service worker](https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope-service-worker)’s [script resource](https://w3c.github.io/ServiceWorker/#dfn-script-resource)’s [has ever been evaluated flag](https://w3c.github.io/ServiceWorker/#dfn-has-ever-been-evaluated-flag) is set, and listener’s [type](https://dom.spec.whatwg.org/#event-listener-type) matches the `[type](https://dom.spec.whatwg.org/#dom-event-type)` attribute value of any of the [service worker events](https://w3c.github.io/ServiceWorker/#dfn-service-worker-events), then [report a warning to the console](https://console.spec.whatwg.org/#report-a-warning-to-the-console) that this might not give the expected results. [\[SERVICE-WORKERS\]](https://dom.spec.whatwg.org/#biblio-service-workers) + 2. If listener’s [signal](https://dom.spec.whatwg.org/#event-listener-signal) is not null and is [aborted](https://dom.spec.whatwg.org/#abortsignal-aborted), then return. + 3. If listener’s [callback](https://dom.spec.whatwg.org/#event-listener-callback) is null, then return. + 4. If eventTarget’s [event listener list](https://dom.spec.whatwg.org/#eventtarget-event-listener-list) does not [contain](https://infra.spec.whatwg.org/#list-contain) an [event listener](https://dom.spec.whatwg.org/#concept-event-listener) whose [type](https://dom.spec.whatwg.org/#event-listener-type) is listener’s [type](https://dom.spec.whatwg.org/#event-listener-type), [callback](https://dom.spec.whatwg.org/#event-listener-callback) is listener’s [callback](https://dom.spec.whatwg.org/#event-listener-callback), and [capture](https://dom.spec.whatwg.org/#event-listener-capture) is listener’s [capture](https://dom.spec.whatwg.org/#event-listener-capture), then [append](https://infra.spec.whatwg.org/#list-append) listener to eventTarget’s [event listener list](https://dom.spec.whatwg.org/#eventtarget-event-listener-list). + 5. If listener’s [signal](https://dom.spec.whatwg.org/#event-listener-signal) is not null, then [add the following](https://dom.spec.whatwg.org/#abortsignal-add) abort steps to it: - + 1. [Remove an event listener](https://dom.spec.whatwg.org/#remove-an-event-listener) with eventTarget and listener. The [add an event listener](https://dom.spec.whatwg.org/#add-an-event-listener) concept exists to ensure [event handlers](https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers) use the same code path. [\[HTML\]](https://dom.spec.whatwg.org/#biblio-html) @@ -1186,12 +1254,16 @@ The [add an event listener](https://dom.spec.whatwg.org/#add-an-event-listener) The `addEventListener(type, callback, options)` method steps are: 1. Let capture, passive, once, and signal be the result of [flattening more](https://dom.spec.whatwg.org/#event-flatten-more) options. + 2. [Add an event listener](https://dom.spec.whatwg.org/#add-an-event-listener) with [this](https://webidl.spec.whatwg.org/#this) and an [event listener](https://dom.spec.whatwg.org/#concept-event-listener) whose [type](https://dom.spec.whatwg.org/#event-listener-type) is type, [callback](https://dom.spec.whatwg.org/#event-listener-callback) is callback, [capture](https://dom.spec.whatwg.org/#event-listener-capture) is capture, [passive](https://dom.spec.whatwg.org/#event-listener-passive) is passive, [once](https://dom.spec.whatwg.org/#event-listener-once) is once, and [signal](https://dom.spec.whatwg.org/#event-listener-signal) is signal. + To remove an event listener, given an `[EventTarget](https://dom.spec.whatwg.org/#eventtarget)` object eventTarget and an [event listener](https://dom.spec.whatwg.org/#concept-event-listener) listener, run these steps: 1. If eventTarget is a `[ServiceWorkerGlobalScope](https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope)` object and its [service worker](https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope-service-worker)’s [set of event types to handle](https://w3c.github.io/ServiceWorker/#dfn-set-of-event-types-to-handle) contains type, then [report a warning to the console](https://console.spec.whatwg.org/#report-a-warning-to-the-console) that this might not give the expected results. [\[SERVICE-WORKERS\]](https://dom.spec.whatwg.org/#biblio-service-workers) + 2. Set listener’s [removed](https://dom.spec.whatwg.org/#event-listener-removed) to true and [remove](https://infra.spec.whatwg.org/#list-remove) listener from eventTarget’s [event listener list](https://dom.spec.whatwg.org/#eventtarget-event-listener-list). + HTML needs this to define event handlers. [\[HTML\]](https://dom.spec.whatwg.org/#biblio-html) @@ -1202,15 +1274,20 @@ HTML needs this to define `document.open()`. [\[HTML\]](https://dom.spec.whatwg. The `removeEventListener(type, callback, options)` method steps are: 1. Let capture be the result of [flattening](https://dom.spec.whatwg.org/#concept-flatten-options) options. + 2. If [this](https://webidl.spec.whatwg.org/#this)’s [event listener list](https://dom.spec.whatwg.org/#eventtarget-event-listener-list) [contains](https://infra.spec.whatwg.org/#list-contain) an [event listener](https://dom.spec.whatwg.org/#concept-event-listener) whose [type](https://dom.spec.whatwg.org/#event-listener-type) is type, [callback](https://dom.spec.whatwg.org/#event-listener-callback) is callback, and [capture](https://dom.spec.whatwg.org/#event-listener-capture) is capture, then [remove an event listener](https://dom.spec.whatwg.org/#remove-an-event-listener) with [this](https://webidl.spec.whatwg.org/#this) and that [event listener](https://dom.spec.whatwg.org/#concept-event-listener). + The event listener list will not contain multiple event listeners with equal type, callback, and capture, as [add an event listener](https://dom.spec.whatwg.org/#add-an-event-listener) prevents that. The `dispatchEvent(event)` method steps are: 1. If event’s [dispatch flag](https://dom.spec.whatwg.org/#dispatch-flag) is set, or if its [initialized flag](https://dom.spec.whatwg.org/#initialized-flag) is not set, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidStateError](https://webidl.spec.whatwg.org/#invalidstateerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. Initialize event’s `[isTrusted](https://dom.spec.whatwg.org/#dom-event-istrusted)` attribute to false. + 3. Return the result of [dispatching](https://dom.spec.whatwg.org/#concept-event-dispatch) event to [this](https://webidl.spec.whatwg.org/#this). + ### 2.8. Observing event listeners[](https://dom.spec.whatwg.org/#observing-event-listeners) @@ -1225,178 +1302,245 @@ Ideally, any new event APIs are defined such that they do not need this property To dispatch an event to a target, with an optional legacy target override flag and an optional legacyOutputDidListenersThrowFlag, run these steps: 1. Set event’s [dispatch flag](https://dom.spec.whatwg.org/#dispatch-flag). + 2. Let targetOverride be target, if legacy target override flag is not given, and target’s [associated `Document`](https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window) otherwise. [\[HTML\]](https://dom.spec.whatwg.org/#biblio-html) - + legacy target override flag is only used by HTML and only when target is a `[Window](https://html.spec.whatwg.org/multipage/window-object.html#window)` object. - + 3. Let activationTarget be null. + 4. Let relatedTarget be the result of [retargeting](https://dom.spec.whatwg.org/#retarget) event’s [relatedTarget](https://dom.spec.whatwg.org/#event-relatedtarget) against target. + 5. If target is not relatedTarget or target is event’s [relatedTarget](https://dom.spec.whatwg.org/#event-relatedtarget), then: - + 1. Let touchTargets be a new [list](https://infra.spec.whatwg.org/#list). + 2. [For each](https://infra.spec.whatwg.org/#list-iterate) touchTarget of event’s [touch target list](https://dom.spec.whatwg.org/#event-touch-target-list), [append](https://infra.spec.whatwg.org/#list-append) the result of [retargeting](https://dom.spec.whatwg.org/#retarget) touchTarget against target to touchTargets. + 3. [Append to an event path](https://dom.spec.whatwg.org/#concept-event-path-append) with event, target, targetOverride, relatedTarget, touchTargets, and false. + 4. Let isActivationEvent be true, if event is a `[MouseEvent](https://www.w3.org/TR/uievents/#mouseevent)` object and event’s `[type](https://dom.spec.whatwg.org/#dom-event-type)` attribute is "`click`"; otherwise false. + 5. If isActivationEvent is true and target has [activation behavior](https://dom.spec.whatwg.org/#eventtarget-activation-behavior), then set activationTarget to target. + 6. Let slottable be target, if target is a [slottable](https://dom.spec.whatwg.org/#concept-slotable) and is [assigned](https://dom.spec.whatwg.org/#slotable-assigned), and null otherwise. + 7. Let slot-in-closed-tree be false. + 8. Let parent be the result of invoking target’s [get the parent](https://dom.spec.whatwg.org/#get-the-parent) with event. + 9. While parent is non-null: - + 1. If slottable is non-null: - + 1. Assert: parent is a [slot](https://dom.spec.whatwg.org/#concept-slot). + 2. Set slottable to null. + 3. If parent’s [root](https://dom.spec.whatwg.org/#concept-tree-root) is a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root) whose [mode](https://dom.spec.whatwg.org/#shadowroot-mode) is "`closed`", then set slot-in-closed-tree to true. - + 2. If parent is a [slottable](https://dom.spec.whatwg.org/#concept-slotable) and is [assigned](https://dom.spec.whatwg.org/#slotable-assigned), then set slottable to parent. + 3. Let relatedTarget be the result of [retargeting](https://dom.spec.whatwg.org/#retarget) event’s [relatedTarget](https://dom.spec.whatwg.org/#event-relatedtarget) against parent. + 4. Let touchTargets be a new [list](https://infra.spec.whatwg.org/#list). + 5. [For each](https://infra.spec.whatwg.org/#list-iterate) touchTarget of event’s [touch target list](https://dom.spec.whatwg.org/#event-touch-target-list), [append](https://infra.spec.whatwg.org/#list-append) the result of [retargeting](https://dom.spec.whatwg.org/#retarget) touchTarget against parent to touchTargets. + 6. If parent is a `[Window](https://html.spec.whatwg.org/multipage/window-object.html#window)` object, or parent is a [node](https://dom.spec.whatwg.org/#concept-node) and target’s [root](https://dom.spec.whatwg.org/#concept-tree-root) is a [shadow-including inclusive ancestor](https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-ancestor) of parent, then: - + 1. If isActivationEvent is true, event’s `[bubbles](https://dom.spec.whatwg.org/#dom-event-bubbles)` attribute is true, activationTarget is null, and parent has [activation behavior](https://dom.spec.whatwg.org/#eventtarget-activation-behavior), then set activationTarget to parent. + 2. [Append to an event path](https://dom.spec.whatwg.org/#concept-event-path-append) with event, parent, null, relatedTarget, touchTargets, and slot-in-closed-tree. - + 7. Otherwise, if parent is relatedTarget, then set parent to null. + 8. Otherwise, set target to parent and then: - + 1. If isActivationEvent is true, activationTarget is null, and target has [activation behavior](https://dom.spec.whatwg.org/#eventtarget-activation-behavior), then set activationTarget to target. + 2. [Append to an event path](https://dom.spec.whatwg.org/#concept-event-path-append) with event, parent, target, relatedTarget, touchTargets, and slot-in-closed-tree. - + 9. If parent is non-null, then set parent to the result of invoking parent’s [get the parent](https://dom.spec.whatwg.org/#get-the-parent) with event. - 10. Set slot-in-closed-tree to false. - - 10. Let clearTargetsStruct be the last struct in event’s [path](https://dom.spec.whatwg.org/#event-path) whose [shadow-adjusted target](https://dom.spec.whatwg.org/#event-path-shadow-adjusted-target) is non-null. - - 11. Let clearTargets be true if clearTargetsStruct’s [shadow-adjusted target](https://dom.spec.whatwg.org/#event-path-shadow-adjusted-target), clearTargetsStruct’s [relatedTarget](https://dom.spec.whatwg.org/#event-path-relatedtarget), or an `[EventTarget](https://dom.spec.whatwg.org/#eventtarget)` object in clearTargetsStruct’s [touch target list](https://dom.spec.whatwg.org/#event-path-touch-target-list) is a [node](https://dom.spec.whatwg.org/#concept-node) and its [root](https://dom.spec.whatwg.org/#concept-tree-root) is a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root); otherwise false. - - 12. If activationTarget is non-null and activationTarget has [legacy-pre-activation behavior](https://dom.spec.whatwg.org/#eventtarget-legacy-pre-activation-behavior), then run activationTarget’s [legacy-pre-activation behavior](https://dom.spec.whatwg.org/#eventtarget-legacy-pre-activation-behavior). - - 13. [For each](https://infra.spec.whatwg.org/#list-iterate) struct in event’s [path](https://dom.spec.whatwg.org/#event-path), in reverse order: - - 14. If struct’s [shadow-adjusted target](https://dom.spec.whatwg.org/#event-path-shadow-adjusted-target) is non-null, then set event’s `[eventPhase](https://dom.spec.whatwg.org/#dom-event-eventphase)` attribute to `[AT_TARGET](https://dom.spec.whatwg.org/#dom-event-at_target)`. - 15. Otherwise, set event’s `[eventPhase](https://dom.spec.whatwg.org/#dom-event-eventphase)` attribute to `[CAPTURING_PHASE](https://dom.spec.whatwg.org/#dom-event-capturing_phase)`. - 16. [Invoke](https://dom.spec.whatwg.org/#concept-event-listener-invoke) with struct, event, "`capturing`", and legacyOutputDidListenersThrowFlag if given. - 17. [For each](https://infra.spec.whatwg.org/#list-iterate) struct in event’s [path](https://dom.spec.whatwg.org/#event-path): - - 18. If struct’s [shadow-adjusted target](https://dom.spec.whatwg.org/#event-path-shadow-adjusted-target) is non-null, then set event’s `[eventPhase](https://dom.spec.whatwg.org/#dom-event-eventphase)` attribute to `[AT_TARGET](https://dom.spec.whatwg.org/#dom-event-at_target)`. - 19. Otherwise: - - 1. If event’s `[bubbles](https://dom.spec.whatwg.org/#dom-event-bubbles)` attribute is false, then [continue](https://infra.spec.whatwg.org/#iteration-continue). - 2. Set event’s `[eventPhase](https://dom.spec.whatwg.org/#dom-event-eventphase)` attribute to `[BUBBLING_PHASE](https://dom.spec.whatwg.org/#dom-event-bubbling_phase)`. - - 20. [Invoke](https://dom.spec.whatwg.org/#concept-event-listener-invoke) with struct, event, "`bubbling`", and legacyOutputDidListenersThrowFlag if given. - + + 10. Set slot-in-closed-tree to false. + + 10. Let clearTargetsStruct be the last struct in event’s [path](https://dom.spec.whatwg.org/#event-path) whose [shadow-adjusted target](https://dom.spec.whatwg.org/#event-path-shadow-adjusted-target) is non-null. + + 11. Let clearTargets be true if clearTargetsStruct’s [shadow-adjusted target](https://dom.spec.whatwg.org/#event-path-shadow-adjusted-target), clearTargetsStruct’s [relatedTarget](https://dom.spec.whatwg.org/#event-path-relatedtarget), or an `[EventTarget](https://dom.spec.whatwg.org/#eventtarget)` object in clearTargetsStruct’s [touch target list](https://dom.spec.whatwg.org/#event-path-touch-target-list) is a [node](https://dom.spec.whatwg.org/#concept-node) and its [root](https://dom.spec.whatwg.org/#concept-tree-root) is a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root); otherwise false. + + 12. If activationTarget is non-null and activationTarget has [legacy-pre-activation behavior](https://dom.spec.whatwg.org/#eventtarget-legacy-pre-activation-behavior), then run activationTarget’s [legacy-pre-activation behavior](https://dom.spec.whatwg.org/#eventtarget-legacy-pre-activation-behavior). + + 13. [For each](https://infra.spec.whatwg.org/#list-iterate) struct in event’s [path](https://dom.spec.whatwg.org/#event-path), in reverse order: + + 1. If struct’s [shadow-adjusted target](https://dom.spec.whatwg.org/#event-path-shadow-adjusted-target) is non-null, then set event’s `[eventPhase](https://dom.spec.whatwg.org/#dom-event-eventphase)` attribute to `[AT_TARGET](https://dom.spec.whatwg.org/#dom-event-at_target)`. + + 2. Otherwise, set event’s `[eventPhase](https://dom.spec.whatwg.org/#dom-event-eventphase)` attribute to `[CAPTURING_PHASE](https://dom.spec.whatwg.org/#dom-event-capturing_phase)`. + + 3. [Invoke](https://dom.spec.whatwg.org/#concept-event-listener-invoke) with struct, event, "`capturing`", and legacyOutputDidListenersThrowFlag if given. + + 14. [For each](https://infra.spec.whatwg.org/#list-iterate) struct in event’s [path](https://dom.spec.whatwg.org/#event-path): + + 1. If struct’s [shadow-adjusted target](https://dom.spec.whatwg.org/#event-path-shadow-adjusted-target) is non-null, then set event’s `[eventPhase](https://dom.spec.whatwg.org/#dom-event-eventphase)` attribute to `[AT_TARGET](https://dom.spec.whatwg.org/#dom-event-at_target)`. + + 2. Otherwise: + + 1. If event’s `[bubbles](https://dom.spec.whatwg.org/#dom-event-bubbles)` attribute is false, then [continue](https://infra.spec.whatwg.org/#iteration-continue). + + 2. Set event’s `[eventPhase](https://dom.spec.whatwg.org/#dom-event-eventphase)` attribute to `[BUBBLING_PHASE](https://dom.spec.whatwg.org/#dom-event-bubbling_phase)`. + + 3. [Invoke](https://dom.spec.whatwg.org/#concept-event-listener-invoke) with struct, event, "`bubbling`", and legacyOutputDidListenersThrowFlag if given. + 6. Set event’s `[eventPhase](https://dom.spec.whatwg.org/#dom-event-eventphase)` attribute to `[NONE](https://dom.spec.whatwg.org/#dom-event-none)`. + 7. Set event’s `[currentTarget](https://dom.spec.whatwg.org/#dom-event-currenttarget)` attribute to null. + 8. Set event’s [path](https://dom.spec.whatwg.org/#event-path) to the empty list. + 9. Unset event’s [dispatch flag](https://dom.spec.whatwg.org/#dispatch-flag), [stop propagation flag](https://dom.spec.whatwg.org/#stop-propagation-flag), and [stop immediate propagation flag](https://dom.spec.whatwg.org/#stop-immediate-propagation-flag). -10. If clearTargets, then: - -11. Set event’s [target](https://dom.spec.whatwg.org/#event-target) to null. -12. Set event’s [relatedTarget](https://dom.spec.whatwg.org/#event-relatedtarget) to null. -13. Set event’s [touch target list](https://dom.spec.whatwg.org/#event-touch-target-list) to the empty list. -14. If activationTarget is non-null, then: - -15. If event’s [canceled flag](https://dom.spec.whatwg.org/#canceled-flag) is unset, then run activationTarget’s [activation behavior](https://dom.spec.whatwg.org/#eventtarget-activation-behavior) with event. -16. Otherwise, if activationTarget has [legacy-canceled-activation behavior](https://dom.spec.whatwg.org/#eventtarget-legacy-canceled-activation-behavior), then run activationTarget’s [legacy-canceled-activation behavior](https://dom.spec.whatwg.org/#eventtarget-legacy-canceled-activation-behavior). -17. Return false if event’s [canceled flag](https://dom.spec.whatwg.org/#canceled-flag) is set; otherwise true. + +10. If clearTargets, then: + + 1. Set event’s [target](https://dom.spec.whatwg.org/#event-target) to null. + + 2. Set event’s [relatedTarget](https://dom.spec.whatwg.org/#event-relatedtarget) to null. + + 3. Set event’s [touch target list](https://dom.spec.whatwg.org/#event-touch-target-list) to the empty list. + +11. If activationTarget is non-null, then: + + 1. If event’s [canceled flag](https://dom.spec.whatwg.org/#canceled-flag) is unset, then run activationTarget’s [activation behavior](https://dom.spec.whatwg.org/#eventtarget-activation-behavior) with event. + + 2. Otherwise, if activationTarget has [legacy-canceled-activation behavior](https://dom.spec.whatwg.org/#eventtarget-legacy-canceled-activation-behavior), then run activationTarget’s [legacy-canceled-activation behavior](https://dom.spec.whatwg.org/#eventtarget-legacy-canceled-activation-behavior). + +12. Return false if event’s [canceled flag](https://dom.spec.whatwg.org/#canceled-flag) is set; otherwise true. + To append to an event path, given an event, invocationTarget, shadowAdjustedTarget, relatedTarget, touchTargets, and a slot-in-closed-tree, run these steps: 1. Let invocationTargetInShadowTree be false. + 2. If invocationTarget is a [node](https://dom.spec.whatwg.org/#concept-node) and its [root](https://dom.spec.whatwg.org/#concept-tree-root) is a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root), then set invocationTargetInShadowTree to true. + 3. Let root-of-closed-tree be false. + 4. If invocationTarget is a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root) whose [mode](https://dom.spec.whatwg.org/#shadowroot-mode) is "`closed`", then set root-of-closed-tree to true. + 5. [Append](https://infra.spec.whatwg.org/#list-append) a new [struct](https://infra.spec.whatwg.org/#struct) to event’s [path](https://dom.spec.whatwg.org/#event-path) whose [invocation target](https://dom.spec.whatwg.org/#event-path-invocation-target) is invocationTarget, [invocation-target-in-shadow-tree](https://dom.spec.whatwg.org/#event-path-invocation-target-in-shadow-tree) is invocationTargetInShadowTree, [shadow-adjusted target](https://dom.spec.whatwg.org/#event-path-shadow-adjusted-target) is shadowAdjustedTarget, [relatedTarget](https://dom.spec.whatwg.org/#event-path-relatedtarget) is relatedTarget, [touch target list](https://dom.spec.whatwg.org/#event-path-touch-target-list) is touchTargets, [root-of-closed-tree](https://dom.spec.whatwg.org/#event-path-root-of-closed-tree) is root-of-closed-tree, and [slot-in-closed-tree](https://dom.spec.whatwg.org/#event-path-slot-in-closed-tree) is slot-in-closed-tree. + To invoke, given a struct, event, phase, and an optional legacyOutputDidListenersThrowFlag, run these steps: 1. Set event’s [target](https://dom.spec.whatwg.org/#event-target) to the [shadow-adjusted target](https://dom.spec.whatwg.org/#event-path-shadow-adjusted-target) of the last struct in event’s [path](https://dom.spec.whatwg.org/#event-path), that is either struct or preceding struct, whose [shadow-adjusted target](https://dom.spec.whatwg.org/#event-path-shadow-adjusted-target) is non-null. + 2. Set event’s [relatedTarget](https://dom.spec.whatwg.org/#event-relatedtarget) to struct’s [relatedTarget](https://dom.spec.whatwg.org/#event-path-relatedtarget). + 3. Set event’s [touch target list](https://dom.spec.whatwg.org/#event-touch-target-list) to struct’s [touch target list](https://dom.spec.whatwg.org/#event-path-touch-target-list). + 4. If event’s [stop propagation flag](https://dom.spec.whatwg.org/#stop-propagation-flag) is set, then return. + 5. Initialize event’s `[currentTarget](https://dom.spec.whatwg.org/#dom-event-currenttarget)` attribute to struct’s [invocation target](https://dom.spec.whatwg.org/#event-path-invocation-target). + 6. Let listeners be a [clone](https://infra.spec.whatwg.org/#list-clone) of event’s `[currentTarget](https://dom.spec.whatwg.org/#dom-event-currenttarget)` attribute value’s [event listener list](https://dom.spec.whatwg.org/#eventtarget-event-listener-list). - + This avoids [event listeners](https://dom.spec.whatwg.org/#concept-event-listener) added after this point from being run. Note that removal still has an effect due to the [removed](https://dom.spec.whatwg.org/#event-listener-removed) field. - + 7. Let invocationTargetInShadowTree be struct’s [invocation-target-in-shadow-tree](https://dom.spec.whatwg.org/#event-path-invocation-target-in-shadow-tree). + 8. Let found be the result of running [inner invoke](https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke) with event, listeners, phase, invocationTargetInShadowTree, and legacyOutputDidListenersThrowFlag if given. + 9. If found is false and event’s `[isTrusted](https://dom.spec.whatwg.org/#dom-event-istrusted)` attribute is true, then: - + 1. Let originalEventType be event’s `[type](https://dom.spec.whatwg.org/#dom-event-type)` attribute value. + 2. If event’s `[type](https://dom.spec.whatwg.org/#dom-event-type)` attribute value is a match for any of the strings in the first column in the following table, set event’s `[type](https://dom.spec.whatwg.org/#dom-event-type)` attribute value to the string in the second column on the same row as the matching string, and return otherwise. - + Event type - + Legacy event type - + "`animationend`" - + "`webkitAnimationEnd`" - + "`animationiteration`" - + "`webkitAnimationIteration`" - + "`animationstart`" - + "`webkitAnimationStart`" - + "`transitionend`" - + "`webkitTransitionEnd`" - + 3. [Inner invoke](https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke) with event, listeners, phase, invocationTargetInShadowTree, and legacyOutputDidListenersThrowFlag if given. + 4. Set event’s `[type](https://dom.spec.whatwg.org/#dom-event-type)` attribute value to originalEventType. + To inner invoke, given an event, listeners, phase, invocationTargetInShadowTree, and an optional legacyOutputDidListenersThrowFlag, run these steps: 1. Let found be false. + 2. [For each](https://infra.spec.whatwg.org/#list-iterate) listener in listeners, whose [removed](https://dom.spec.whatwg.org/#event-listener-removed) is false: - + 1. If event’s `[type](https://dom.spec.whatwg.org/#dom-event-type)` attribute value is not listener’s [type](https://dom.spec.whatwg.org/#event-listener-type), then [continue](https://infra.spec.whatwg.org/#iteration-continue). + 2. Set found to true. + 3. If phase is "`capturing`" and listener’s [capture](https://dom.spec.whatwg.org/#event-listener-capture) is false, then [continue](https://infra.spec.whatwg.org/#iteration-continue). + 4. If phase is "`bubbling`" and listener’s [capture](https://dom.spec.whatwg.org/#event-listener-capture) is true, then [continue](https://infra.spec.whatwg.org/#iteration-continue). + 5. If listener’s [once](https://dom.spec.whatwg.org/#event-listener-once) is true, then [remove](https://infra.spec.whatwg.org/#list-remove) listener from event’s `[currentTarget](https://dom.spec.whatwg.org/#dom-event-currenttarget)` attribute value’s [event listener list](https://dom.spec.whatwg.org/#eventtarget-event-listener-list). + 6. Let global be listener [callback](https://dom.spec.whatwg.org/#event-listener-callback)’s [associated Realm](https://webidl.spec.whatwg.org/#dfn-associated-realm)’s [global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-realm-global). + 7. Let currentEvent be undefined. + 8. If global is a `[Window](https://html.spec.whatwg.org/multipage/window-object.html#window)` object, then: - + 1. Set currentEvent to global’s [current event](https://dom.spec.whatwg.org/#window-current-event). + 2. If invocationTargetInShadowTree is false, then set global’s [current event](https://dom.spec.whatwg.org/#window-current-event) to event. - + 9. If listener’s [passive](https://dom.spec.whatwg.org/#event-listener-passive) is true, then set event’s [in passive listener flag](https://dom.spec.whatwg.org/#in-passive-listener-flag). - 10. [Call a user object’s operation](https://webidl.spec.whatwg.org/#call-a-user-objects-operation) with listener’s [callback](https://dom.spec.whatwg.org/#event-listener-callback), "`handleEvent`", « event », and event’s `[currentTarget](https://dom.spec.whatwg.org/#dom-event-currenttarget)` attribute value. If this throws an exception, then: - - 11. [Report the exception](https://html.spec.whatwg.org/multipage/webappapis.html#report-the-exception). - 12. Set legacyOutputDidListenersThrowFlag if given. - - The legacyOutputDidListenersThrowFlag is only used by Indexed Database API. [\[INDEXEDDB\]](https://dom.spec.whatwg.org/#biblio-indexeddb) - - 13. Unset event’s [in passive listener flag](https://dom.spec.whatwg.org/#in-passive-listener-flag). - - 14. If global is a `[Window](https://html.spec.whatwg.org/multipage/window-object.html#window)` object, then set global’s [current event](https://dom.spec.whatwg.org/#window-current-event) to currentEvent. - - 15. If event’s [stop immediate propagation flag](https://dom.spec.whatwg.org/#stop-immediate-propagation-flag) is set, then return found. - + + 10. [Call a user object’s operation](https://webidl.spec.whatwg.org/#call-a-user-objects-operation) with listener’s [callback](https://dom.spec.whatwg.org/#event-listener-callback), "`handleEvent`", « event », and event’s `[currentTarget](https://dom.spec.whatwg.org/#dom-event-currenttarget)` attribute value. If this throws an exception, then: + + 1. [Report the exception](https://html.spec.whatwg.org/multipage/webappapis.html#report-the-exception). + + 2. Set legacyOutputDidListenersThrowFlag if given. + + The legacyOutputDidListenersThrowFlag is only used by Indexed Database API. [\[INDEXEDDB\]](https://dom.spec.whatwg.org/#biblio-indexeddb) + + 11. Unset event’s [in passive listener flag](https://dom.spec.whatwg.org/#in-passive-listener-flag). + + 12. If global is a `[Window](https://html.spec.whatwg.org/multipage/window-object.html#window)` object, then set global’s [current event](https://dom.spec.whatwg.org/#window-current-event) to currentEvent. + + 13. If event’s [stop immediate propagation flag](https://dom.spec.whatwg.org/#stop-immediate-propagation-flag) is set, then return found. + 3. Return found. + ### 2.10. Firing events[](https://dom.spec.whatwg.org/#firing-events) To fire an event named e at target, optionally using an eventConstructor, with a description of how IDL attributes are to be initialized, and a legacy target override flag, run these steps: 1. If eventConstructor is not given, then let eventConstructor be `[Event](https://dom.spec.whatwg.org/#event)`. + 2. Let event be the result of [creating an event](https://dom.spec.whatwg.org/#concept-event-create) given eventConstructor, in the [relevant Realm](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm) of target. + 3. Initialize event’s `[type](https://dom.spec.whatwg.org/#dom-event-type)` attribute to e. + 4. Initialize any other IDL attributes of event as described in the invocation of this algorithm. - + This also allows for the `[isTrusted](https://dom.spec.whatwg.org/#dom-event-istrusted)` attribute to be set to false. - + 5. Return the result of [dispatching](https://dom.spec.whatwg.org/#concept-event-dispatch) event at target, with legacy target override flag set if set. + Fire in the context of DOM is short for [creating](https://dom.spec.whatwg.org/#concept-event-create), initializing, and [dispatching](https://dom.spec.whatwg.org/#concept-event-dispatch) an [event](https://dom.spec.whatwg.org/#concept-event). [Fire an event](https://dom.spec.whatwg.org/#concept-event-fire) makes that process easier to write down. @@ -1407,7 +1551,9 @@ Or, when a custom constructor is needed, "[fire an event](https://dom.spec.whatw Occasionally the return value is important: 1. Let doAction be the result of [firing an event](https://dom.spec.whatwg.org/#concept-event-fire) named `like` at target. + 2. If doAction is true, then … + ### 2.11. Action versus occurrence[](https://dom.spec.whatwg.org/#action-versus-occurance) @@ -1465,78 +1611,78 @@ APIs that require more granular control could extend both `[AbortController](htt ### 3.1. Interface `[AbortController](https://dom.spec.whatwg.org/#abortcontroller)`[](https://dom.spec.whatwg.org/#interface-abortcontroller) -[AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController 'The AbortController interface represents a controller object that allows you to abort one or more Web requests as and when desired.') +[AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController "The AbortController interface represents a controller object that allows you to abort one or more Web requests as and when desired.") In all current engines. Firefox57+Safari12.1+Chrome66+ ---- +___ Opera53+Edge79+ ---- +___ Edge (Legacy)16+IENone ---- +___ Firefox for Android57+iOS Safari12.2+Chrome for Android66+Android WebView66+Samsung Internet9.0+Opera Mobile47+ ---- +___ Node.js15.0.0+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=(Window,Worker)\] interface `AbortController` { -[constructor](https://dom.spec.whatwg.org/#dom-abortcontroller-abortcontroller)(); + [constructor](https://dom.spec.whatwg.org/#dom-abortcontroller-abortcontroller)(); -\[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [AbortSignal](https://dom.spec.whatwg.org/#abortsignal) [signal](https://dom.spec.whatwg.org/#dom-abortcontroller-signal); + \[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [AbortSignal](https://dom.spec.whatwg.org/#abortsignal) [signal](https://dom.spec.whatwg.org/#dom-abortcontroller-signal); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [abort](https://dom.spec.whatwg.org/#dom-abortcontroller-abort)(optional [any](https://webidl.spec.whatwg.org/#idl-any) `reason`[](https://dom.spec.whatwg.org/#dom-abortcontroller-abort-reason-reason)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [abort](https://dom.spec.whatwg.org/#dom-abortcontroller-abort)(optional [any](https://webidl.spec.whatwg.org/#idl-any) `reason`[](https://dom.spec.whatwg.org/#dom-abortcontroller-abort-reason-reason)); }; -[AbortController/AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/AbortController 'The AbortController() constructor creates a new AbortController object instance.') +[AbortController/AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/AbortController "The AbortController() constructor creates a new AbortController object instance.") In all current engines. Firefox57+Safari12.1+Chrome66+ ---- +___ Opera53+Edge79+ ---- +___ Edge (Legacy)16+IENone ---- +___ Firefox for Android57+iOS Safari12.2+Chrome for Android66+Android WebView66+Samsung Internet9.0+Opera Mobile47+ ---- +___ Node.js15.0.0+ -[AbortController/abort](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort 'The abort() method of the AbortController interface aborts a DOM request before it has completed. This is able to abort fetch requests, the consumption of any response bodies, or streams.') +[AbortController/abort](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort "The abort() method of the AbortController interface aborts a DOM request before it has completed. This is able to abort fetch requests, the consumption of any response bodies, or streams.") In all current engines. Firefox57+Safari12.1+Chrome66+ ---- +___ Opera53+Edge79+ ---- +___ Edge (Legacy)16+IENone ---- +___ Firefox for Android57+iOS Safari12.2+Chrome for Android66+Android WebView66+Samsung Internet9.0+Opera Mobile47+ ---- +___ Node.js15.0.0+ @@ -1544,25 +1690,25 @@ Node.js15.0.0+ Returns a new controller whose `[signal](https://dom.spec.whatwg.org/#dom-abortcontroller-signal)` is set to a newly created `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)` object. -[AbortController/signal](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/signal 'The signal read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort a DOM request as desired.') +[AbortController/signal](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/signal "The signal read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort a DOM request as desired.") In all current engines. Firefox57+Safari12.1+Chrome66+ ---- +___ Opera53+Edge79+ ---- +___ Edge (Legacy)16+IENone ---- +___ Firefox for Android57+iOS Safari12.2+Chrome for Android66+Android WebView66+Samsung Internet9.0+Opera Mobile47+ ---- +___ Node.js15.0.0+ @@ -1579,7 +1725,9 @@ An `[AbortController](https://dom.spec.whatwg.org/#abortcontroller)` object has The `new AbortController()` constructor steps are: 1. Let signal be a new `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)` object. + 2. Set [this](https://webidl.spec.whatwg.org/#this)’s [signal](https://dom.spec.whatwg.org/#abortcontroller-signal) to signal. + The `signal` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [signal](https://dom.spec.whatwg.org/#abortcontroller-signal). @@ -1587,58 +1735,58 @@ The `abort(reason)` method steps are to [signal abort](https://dom.spec.whatwg.o ### 3.2. Interface `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)`[](https://dom.spec.whatwg.org/#interface-AbortSignal) -[AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal 'The AbortSignal interface represents a signal object that allows you to communicate with a DOM request (such as a fetch request) and abort it if required via an AbortController object.') +[AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal "The AbortSignal interface represents a signal object that allows you to communicate with a DOM request (such as a fetch request) and abort it if required via an AbortController object.") In all current engines. Firefox57+Safari11.1+Chrome66+ ---- +___ Opera53+Edge79+ ---- +___ Edge (Legacy)16+IENone ---- +___ Firefox for Android57+iOS Safari11.3+Chrome for Android66+Android WebView66+Samsung Internet9.0+Opera Mobile47+ ---- +___ Node.js15.0.0+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=(Window,Worker)\] interface `AbortSignal` : [EventTarget](https://dom.spec.whatwg.org/#eventtarget) { -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] static [AbortSignal](https://dom.spec.whatwg.org/#abortsignal) [abort](https://dom.spec.whatwg.org/#dom-abortsignal-abort)(optional [any](https://webidl.spec.whatwg.org/#idl-any) `reason`[](https://dom.spec.whatwg.org/#dom-abortsignal-abort-reason-reason)); + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] static [AbortSignal](https://dom.spec.whatwg.org/#abortsignal) [abort](https://dom.spec.whatwg.org/#dom-abortsignal-abort)(optional [any](https://webidl.spec.whatwg.org/#idl-any) `reason`[](https://dom.spec.whatwg.org/#dom-abortsignal-abort-reason-reason)); -readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [aborted](https://dom.spec.whatwg.org/#dom-abortsignal-aborted); -readonly attribute [any](https://webidl.spec.whatwg.org/#idl-any) [reason](https://dom.spec.whatwg.org/#dom-abortsignal-reason); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [throwIfAborted](https://dom.spec.whatwg.org/#dom-abortsignal-throwifaborted)(); + readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [aborted](https://dom.spec.whatwg.org/#dom-abortsignal-aborted); + readonly attribute [any](https://webidl.spec.whatwg.org/#idl-any) [reason](https://dom.spec.whatwg.org/#dom-abortsignal-reason); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [throwIfAborted](https://dom.spec.whatwg.org/#dom-abortsignal-throwifaborted)(); -attribute [EventHandler](https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler) [onabort](https://dom.spec.whatwg.org/#dom-abortsignal-onabort); + attribute [EventHandler](https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler) [onabort](https://dom.spec.whatwg.org/#dom-abortsignal-onabort); }; -[AbortSignal/abort](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort 'The static AbortSignal.abort() method returns an AbortSignal that is already set as aborted (and which does not trigger an abort event).') +[AbortSignal/abort](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort "The static AbortSignal.abort() method returns an AbortSignal that is already set as aborted (and which does not trigger an abort event).") In all current engines. Firefox88+Safari15+Chrome93+ ---- +___ Opera79+Edge93+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android88+iOS Safari15+Chrome for Android93+Android WebView93+Samsung InternetNoneOpera MobileNone ---- +___ Node.jsNone @@ -1646,25 +1794,25 @@ Node.jsNone Returns an `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)` instance whose [abort reason](https://dom.spec.whatwg.org/#abortsignal-abort-reason) is set to reason if not undefined; otherwise to an "`[AbortError](https://webidl.spec.whatwg.org/#aborterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. -[AbortSignal/aborted](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/aborted 'The aborted read-only property returns a value that indicates whether the DOM requests the signal is communicating with are aborted (true) or not (false).') +[AbortSignal/aborted](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/aborted "The aborted read-only property returns a value that indicates whether the DOM requests the signal is communicating with are aborted (true) or not (false).") In all current engines. Firefox57+Safari11.1+Chrome66+ ---- +___ Opera53+Edge79+ ---- +___ Edge (Legacy)16+IENone ---- +___ Firefox for Android57+iOS Safari11.3+Chrome for Android66+Android WebView66+Samsung Internet9.0+Opera Mobile47+ ---- +___ Node.js15.0.0+ @@ -1689,7 +1837,9 @@ An `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)` object has associat To add an algorithm algorithm to an `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)` object signal, run these steps: 1. If signal is [aborted](https://dom.spec.whatwg.org/#abortsignal-aborted), then return. + 2. [Append](https://infra.spec.whatwg.org/#set-append) algorithm to signal’s [abort algorithms](https://dom.spec.whatwg.org/#abortsignal-abort-algorithms). + To remove[](https://dom.spec.whatwg.org/#abortsignal-remove) an algorithm algorithm from an `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)` signal, [remove](https://infra.spec.whatwg.org/#list-remove) algorithm from signal’s [abort algorithms](https://dom.spec.whatwg.org/#abortsignal-abort-algorithms). @@ -1698,7 +1848,9 @@ The [abort algorithms](https://dom.spec.whatwg.org/#abortsignal-abort-algorithms The static `abort(reason)` method steps are: 1. Let signal be a new `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)` object. + 2. Set signal’s [abort reason](https://dom.spec.whatwg.org/#abortsignal-abort-reason) to reason if it is given; otherwise to a new "`[AbortError](https://webidl.spec.whatwg.org/#aborterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 3. Return signal. The `aborted` getter steps are to return true if [this](https://webidl.spec.whatwg.org/#this) is [aborted](https://dom.spec.whatwg.org/#abortsignal-aborted); otherwise false. @@ -1710,58 +1862,57 @@ The `throwIfAborted()` method steps are to throw [this](https://webidl.spec.what This method is primarily useful for when functions accepting `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)`s want to throw (or return a rejected promise) at specific checkpoints, instead of passing along the `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)` to other methods. For example, the following function allows aborting in between each attempt to poll for a condition. This gives opportunities to abort the polling process, even though the actual asynchronous operation (i.e., `await func()`) does not accept an `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)`. async function waitForCondition(func, targetValue, { signal } \= {}) { -while (true) { -signal?.throwIfAborted(); + while (true) { + signal?.throwIfAborted(); const result \= await func(); if (result \=== targetValue) { return; } - -} + } } -[AbortSignal/abort_event](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_event 'The abort event of the Fetch API is fired when a fetch request is aborted, i.e. using AbortController.abort().') +[AbortSignal/abort\_event](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_event "The abort event of the Fetch API is fired when a fetch request is aborted, i.e. using AbortController.abort().") In all current engines. Firefox57+Safari11.1+Chrome66+ ---- +___ Opera53+Edge79+ ---- +___ Edge (Legacy)16+IENone ---- +___ Firefox for Android57+iOS Safari11.3+Chrome for Android66+Android WebView66+Samsung Internet9.0+Opera Mobile47+ ---- +___ Node.js15.0.0+ -[AbortSignal/onabort](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/onabort 'The onabort read-only property of the AbortSignal interface is an event handler invoked when an abort event fires, i.e. when the fetch requests the signal is communicating with are aborted.') +[AbortSignal/onabort](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/onabort "The onabort read-only property of the AbortSignal interface is an event handler invoked when an abort event fires, i.e. when the fetch requests the signal is communicating with are aborted.") In all current engines. Firefox57+Safari11.1+Chrome66+ ---- +___ Opera53+Edge79+ ---- +___ Edge (Legacy)16+IENone ---- +___ Firefox for Android57+iOS Safari11.3+Chrome for Android66+Android WebView66+Samsung Internet9.0+Opera Mobile47+ ---- +___ Node.js15.0.0+ @@ -1772,18 +1923,26 @@ Changes to an `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)` object r To signal abort, given an `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)` object signal and an optional reason, run these steps: 1. If signal is [aborted](https://dom.spec.whatwg.org/#abortsignal-aborted), then return. + 2. Set signal’s [abort reason](https://dom.spec.whatwg.org/#abortsignal-abort-reason) to reason if it is given; otherwise to a new "`[AbortError](https://webidl.spec.whatwg.org/#aborterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 3. [For each](https://infra.spec.whatwg.org/#list-iterate) algorithm in signal’s [abort algorithms](https://dom.spec.whatwg.org/#abortsignal-abort-algorithms): run algorithm. + 4. [Empty](https://infra.spec.whatwg.org/#list-empty) signal’s [abort algorithms](https://dom.spec.whatwg.org/#abortsignal-abort-algorithms). + 5. [Fire an event](https://dom.spec.whatwg.org/#concept-event-fire) named `[abort](https://dom.spec.whatwg.org/#eventdef-abortsignal-abort)` at signal. + A followingSignal (an `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)`) is made to follow[](https://dom.spec.whatwg.org/#abortsignal-follow) a parentSignal (an `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)`) by running these steps: 1. If followingSignal is [aborted](https://dom.spec.whatwg.org/#abortsignal-aborted), then return. + 2. If parentSignal is [aborted](https://dom.spec.whatwg.org/#abortsignal-aborted), then [signal abort](https://dom.spec.whatwg.org/#abortsignal-signal-abort) on followingSignal with parentSignal’s [abort reason](https://dom.spec.whatwg.org/#abortsignal-abort-reason). + 3. Otherwise, [add the following abort steps](https://dom.spec.whatwg.org/#abortsignal-add) to parentSignal: - + 1. [Signal abort](https://dom.spec.whatwg.org/#abortsignal-signal-abort) on followingSignal with parentSignal’s [abort reason](https://dom.spec.whatwg.org/#abortsignal-abort-reason). + ### 3.3. Using `[AbortController](https://dom.spec.whatwg.org/#abortcontroller)` and `[AbortSignal](https://dom.spec.whatwg.org/#abortsignal)` objects in APIs[](https://dom.spec.whatwg.org/#abortcontroller-api-integration) @@ -1841,10 +2000,15 @@ A [node tree](https://dom.spec.whatwg.org/#concept-node-tree) is constrained as In [tree order](https://dom.spec.whatwg.org/#concept-tree-order): 1. Zero or more `[ProcessingInstruction](https://dom.spec.whatwg.org/#processinginstruction)` or `[Comment](https://dom.spec.whatwg.org/#comment)` [nodes](https://dom.spec.whatwg.org/#concept-node). + 2. Optionally one `[DocumentType](https://dom.spec.whatwg.org/#documenttype)` [node](https://dom.spec.whatwg.org/#concept-node). + 3. Zero or more `[ProcessingInstruction](https://dom.spec.whatwg.org/#processinginstruction)` or `[Comment](https://dom.spec.whatwg.org/#comment)` [nodes](https://dom.spec.whatwg.org/#concept-node). + 4. Optionally one `[Element](https://dom.spec.whatwg.org/#element)` [node](https://dom.spec.whatwg.org/#concept-node). + 5. Zero or more `[ProcessingInstruction](https://dom.spec.whatwg.org/#processinginstruction)` or `[Comment](https://dom.spec.whatwg.org/#comment)` [nodes](https://dom.spec.whatwg.org/#concept-node). + `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` @@ -1865,8 +2029,11 @@ No [children](https://dom.spec.whatwg.org/#concept-tree-child). To determine the length of a [node](https://dom.spec.whatwg.org/#concept-node) node, run these steps: 1. If node is a `[DocumentType](https://dom.spec.whatwg.org/#documenttype)` or `[Attr](https://dom.spec.whatwg.org/#attr)` [node](https://dom.spec.whatwg.org/#concept-node), then return 0. + 2. If node is a `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then return node’s [data](https://dom.spec.whatwg.org/#concept-cd-data)’s [length](https://infra.spec.whatwg.org/#string-length). + 3. Return the number of node’s [children](https://dom.spec.whatwg.org/#concept-tree-child). + A [node](https://dom.spec.whatwg.org/#concept-node) is considered empty if its [length](https://dom.spec.whatwg.org/#concept-node-length) is 0. @@ -1894,21 +2061,21 @@ An [element](https://dom.spec.whatwg.org/#concept-element) is connected if its [ ##### 4.2.2.1. Slots[](https://dom.spec.whatwg.org/#shadow-tree-slots) -[Element/slot](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot 'The HTML element—part of the Web Components technology suite—is a placeholder inside a web component that you can fill with your own markup, which lets you create separate DOM trees and present them together.') +[Element/slot](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot "The HTML element—part of the Web Components technology suite—is a placeholder inside a web component that you can fill with your own markup, which lets you create separate DOM trees and present them together.") In all current engines. Firefox63+Safari10+Chrome53+ ---- +___ Opera40+Edge79+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android63+iOS Safari10+Chrome for Android53+Android WebView53+Samsung Internet6.0+Opera Mobile41+ @@ -1921,13 +2088,19 @@ A [slot](https://dom.spec.whatwg.org/#concept-slot) has an associated name (a st Use these [attribute change steps](https://dom.spec.whatwg.org/#concept-element-attributes-change-ext) to update a [slot](https://dom.spec.whatwg.org/#concept-slot)’s [name](https://dom.spec.whatwg.org/#slot-name): 1. If element is a [slot](https://dom.spec.whatwg.org/#concept-slot), localName is `name`, and namespace is null, then: - + 1. If value is oldValue, then return. + 2. If value is null and oldValue is the empty string, then return. + 3. If value is the empty string and oldValue is null, then return. + 4. If value is null or the empty string, then set element’s [name](https://dom.spec.whatwg.org/#slot-name) to the empty string. + 5. Otherwise, set element’s [name](https://dom.spec.whatwg.org/#slot-name) to value. + 6. Run [assign slottables for a tree](https://dom.spec.whatwg.org/#assign-slotables-for-a-tree) with element’s [root](https://dom.spec.whatwg.org/#concept-tree-root). + The first [slot](https://dom.spec.whatwg.org/#concept-slot) in a [shadow tree](https://dom.spec.whatwg.org/#concept-shadow-tree), in [tree order](https://dom.spec.whatwg.org/#concept-tree-order), whose [name](https://dom.spec.whatwg.org/#slot-name) is the empty string, is sometimes known as the "default slot". @@ -1944,14 +2117,21 @@ A [slottable](https://dom.spec.whatwg.org/#concept-slotable) has an associated n Use these [attribute change steps](https://dom.spec.whatwg.org/#concept-element-attributes-change-ext) to update a [slottable](https://dom.spec.whatwg.org/#concept-slotable)’s [name](https://dom.spec.whatwg.org/#slotable-name): 1. If localName is `slot` and namespace is null, then: - + 1. If value is oldValue, then return. + 2. If value is null and oldValue is the empty string, then return. + 3. If value is the empty string and oldValue is null, then return. + 4. If value is null or the empty string, then set element’s [name](https://dom.spec.whatwg.org/#slotable-name) to the empty string. + 5. Otherwise, set element’s [name](https://dom.spec.whatwg.org/#slotable-name) to value. + 6. If element is [assigned](https://dom.spec.whatwg.org/#slotable-assigned), then run [assign slottables](https://dom.spec.whatwg.org/#assign-slotables) for element’s [assigned slot](https://dom.spec.whatwg.org/#slotable-assigned-slot). + 7. Run [assign a slot](https://dom.spec.whatwg.org/#assign-a-slot) for element. + A [slottable](https://dom.spec.whatwg.org/#concept-slotable) has an associated assigned slot (null or a [slot](https://dom.spec.whatwg.org/#concept-slot)). Unless stated otherwise it is null. A [slottable](https://dom.spec.whatwg.org/#concept-slotable) is assigned if its [assigned slot](https://dom.spec.whatwg.org/#slotable-assigned-slot) is non-null. @@ -1964,62 +2144,87 @@ A [slottable](https://dom.spec.whatwg.org/#concept-slotable)’s [manual slot as To find a slot for a given [slottable](https://dom.spec.whatwg.org/#concept-slotable) slottable and an optional _open flag_ (unset unless stated otherwise), run these steps: 1. If slottable’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is null, then return null. + 2. Let shadow be slottable’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent)’s [shadow root](https://dom.spec.whatwg.org/#concept-element-shadow-root). + 3. If shadow is null, then return null. + 4. If the _open flag_ is set and shadow’s [mode](https://dom.spec.whatwg.org/#shadowroot-mode) is _not_ "`open`", then return null. + 5. If shadow’s [slot assignment](https://dom.spec.whatwg.org/#shadowroot-slot-assignment) is "`manual`", then return the [slot](https://dom.spec.whatwg.org/#concept-slot) in shadow’s [descendants](https://dom.spec.whatwg.org/#concept-tree-descendant) whose [manually assigned nodes](https://html.spec.whatwg.org/multipage/scripting.html#manually-assigned-nodes) [contains](https://infra.spec.whatwg.org/#list-contain) slottable, if any; otherwise null. + 6. Return the first [slot](https://dom.spec.whatwg.org/#concept-slot) in [tree order](https://dom.spec.whatwg.org/#concept-tree-order) in shadow’s [descendants](https://dom.spec.whatwg.org/#concept-tree-descendant) whose [name](https://dom.spec.whatwg.org/#slot-name) is slottable’s [name](https://dom.spec.whatwg.org/#slotable-name), if any; otherwise null. + To find slottables for a given [slot](https://dom.spec.whatwg.org/#concept-slot) slot, run these steps: 1. Let result be an empty list. + 2. Let root be slot’s [root](https://dom.spec.whatwg.org/#concept-tree-root). + 3. If root is not a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root), then return result. + 4. Let host be root’s [host](https://dom.spec.whatwg.org/#concept-documentfragment-host). + 5. If root’s [slot assignment](https://dom.spec.whatwg.org/#shadowroot-slot-assignment) is "`manual`", then: - + 1. Let result be « ». + 2. [For each](https://infra.spec.whatwg.org/#list-iterate) [slottable](https://dom.spec.whatwg.org/#concept-slotable) slottable of slot’s [manually assigned nodes](https://html.spec.whatwg.org/multipage/scripting.html#manually-assigned-nodes), if slottable’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is host, [append](https://infra.spec.whatwg.org/#list-append) slottable to result. - + 6. Otherwise, for each [slottable](https://dom.spec.whatwg.org/#concept-slotable) [child](https://dom.spec.whatwg.org/#concept-tree-child) slottable of host, in [tree order](https://dom.spec.whatwg.org/#concept-tree-order): - + 1. Let foundSlot be the result of [finding a slot](https://dom.spec.whatwg.org/#find-a-slot) given slottable. + 2. If foundSlot is slot, then [append](https://infra.spec.whatwg.org/#list-append) slottable to result. - + 7. Return result. + To find flattened slottables for a given [slot](https://dom.spec.whatwg.org/#concept-slot) slot, run these steps: 1. Let result be an empty list. + 2. If slot’s [root](https://dom.spec.whatwg.org/#concept-tree-root) is not a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root), then return result. + 3. Let slottables be the result of [finding slottables](https://dom.spec.whatwg.org/#find-slotables) given slot. + 4. If slottables is the empty list, then append each [slottable](https://dom.spec.whatwg.org/#concept-slotable) [child](https://dom.spec.whatwg.org/#concept-tree-child) of slot, in [tree order](https://dom.spec.whatwg.org/#concept-tree-order), to slottables. + 5. For each node in slottables: - + 1. If node is a [slot](https://dom.spec.whatwg.org/#concept-slot) whose [root](https://dom.spec.whatwg.org/#concept-tree-root) is a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root), then: - + 1. Let temporaryResult be the result of [finding flattened slottables](https://dom.spec.whatwg.org/#find-flattened-slotables) given node. + 2. Append each [slottable](https://dom.spec.whatwg.org/#concept-slotable) in temporaryResult, in order, to result. - + 2. Otherwise, append node to result. - + 6. Return result. + ##### 4.2.2.4. Assigning slottables and slots[](https://dom.spec.whatwg.org/#assigning-slotables-and-slots) To assign slottables for a [slot](https://dom.spec.whatwg.org/#concept-slot) slot, run these steps: 1. Let slottables be the result of [finding slottables](https://dom.spec.whatwg.org/#find-slotables) for slot. + 2. If slottables and slot’s [assigned nodes](https://dom.spec.whatwg.org/#slot-assigned-nodes) are not identical, then run [signal a slot change](https://dom.spec.whatwg.org/#signal-a-slot-change) for slot. + 3. Set slot’s [assigned nodes](https://dom.spec.whatwg.org/#slot-assigned-nodes) to slottables. + 4. For each slottable in slottables, set slottable’s [assigned slot](https://dom.spec.whatwg.org/#slotable-assigned-slot) to slot. + To assign slottables for a tree, given a [node](https://dom.spec.whatwg.org/#concept-node) root, run [assign slottables](https://dom.spec.whatwg.org/#assign-slotables) for each [slot](https://dom.spec.whatwg.org/#concept-slot) slot in root’s [inclusive descendants](https://dom.spec.whatwg.org/#concept-tree-inclusive-descendant), in [tree order](https://dom.spec.whatwg.org/#concept-tree-order). To assign a slot, given a [slottable](https://dom.spec.whatwg.org/#concept-slotable) slottable, run these steps: 1. Let slot be the result of [finding a slot](https://dom.spec.whatwg.org/#find-a-slot) with slottable. + 2. If slot is non-null, then run [assign slottables](https://dom.spec.whatwg.org/#assign-slotables) for slot. + ##### 4.2.2.5. Signaling slot change[](https://dom.spec.whatwg.org/#signaling-slot-change) @@ -2028,40 +2233,53 @@ Each [similar-origin window agent](https://html.spec.whatwg.org/multipage/webapp To signal a slot change, for a [slot](https://dom.spec.whatwg.org/#concept-slot) slot, run these steps: 1. [Append](https://infra.spec.whatwg.org/#set-append) slot to slot’s [relevant agent](https://html.spec.whatwg.org/multipage/webappapis.html#relevant-agent)’s [signal slots](https://dom.spec.whatwg.org/#signal-slot-list). + 2. [Queue a mutation observer microtask](https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask). + #### 4.2.3. Mutation algorithms[](https://dom.spec.whatwg.org/#mutation-algorithms) To ensure pre-insertion validity of a node into a parent before a child, run these steps: 1. If parent is not a `[Document](https://dom.spec.whatwg.org/#document)`, `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)`, or `[Element](https://dom.spec.whatwg.org/#element)` [node](https://dom.spec.whatwg.org/#concept-node), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. If node is a [host-including inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-host-including-inclusive-ancestor) of parent, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 3. If child is non-null and its [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is not parent, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotFoundError](https://webidl.spec.whatwg.org/#notfounderror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 4. If node is not a `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)`, `[DocumentType](https://dom.spec.whatwg.org/#documenttype)`, `[Element](https://dom.spec.whatwg.org/#element)`, or `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 5. If either node is a `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node) and parent is a [document](https://dom.spec.whatwg.org/#concept-document), or node is a [doctype](https://dom.spec.whatwg.org/#concept-doctype) and parent is not a [document](https://dom.spec.whatwg.org/#concept-document), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 6. If parent is a [document](https://dom.spec.whatwg.org/#concept-document), and any of the statements below, switched on the interface node [implements](https://webidl.spec.whatwg.org/#implements), are true, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. - + `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` - + If node has more than one [element](https://dom.spec.whatwg.org/#concept-element) [child](https://dom.spec.whatwg.org/#concept-tree-child) or has a `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node) [child](https://dom.spec.whatwg.org/#concept-tree-child). - + Otherwise, if node has one [element](https://dom.spec.whatwg.org/#concept-element) [child](https://dom.spec.whatwg.org/#concept-tree-child) and either parent has an [element](https://dom.spec.whatwg.org/#concept-element) [child](https://dom.spec.whatwg.org/#concept-tree-child), child is a [doctype](https://dom.spec.whatwg.org/#concept-doctype), or child is non-null and a [doctype](https://dom.spec.whatwg.org/#concept-doctype) is [following](https://dom.spec.whatwg.org/#concept-tree-following) child. - + `[Element](https://dom.spec.whatwg.org/#element)` - + parent has an [element](https://dom.spec.whatwg.org/#concept-element) [child](https://dom.spec.whatwg.org/#concept-tree-child), child is a [doctype](https://dom.spec.whatwg.org/#concept-doctype), or child is non-null and a [doctype](https://dom.spec.whatwg.org/#concept-doctype) is [following](https://dom.spec.whatwg.org/#concept-tree-following) child. - + `[DocumentType](https://dom.spec.whatwg.org/#documenttype)` - + parent has a [doctype](https://dom.spec.whatwg.org/#concept-doctype) [child](https://dom.spec.whatwg.org/#concept-tree-child), child is non-null and an [element](https://dom.spec.whatwg.org/#concept-element) is [preceding](https://dom.spec.whatwg.org/#concept-tree-preceding) child, or child is null and parent has an [element](https://dom.spec.whatwg.org/#concept-element) [child](https://dom.spec.whatwg.org/#concept-tree-child). + To pre-insert a node into a parent before a child, run these steps: 1. [Ensure pre-insertion validity](https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity) of node into parent before child. + 2. Let referenceChild be child. + 3. If referenceChild is node, then set referenceChild to node’s [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling). + 4. [Insert](https://dom.spec.whatwg.org/#concept-node-insert) node into parent before referenceChild. + 5. Return node. + [Specifications](https://dom.spec.whatwg.org/#other-applicable-specifications) may define insertion steps for all or some [nodes](https://dom.spec.whatwg.org/#concept-node). The algorithm is passed insertedNode, as indicated in the [insert](https://dom.spec.whatwg.org/#concept-node-insert) algorithm below. @@ -2070,156 +2288,207 @@ To pre-insert a node into a parent before a child, run these steps: To insert a node into a parent before a child, with an optional _suppress observers flag_, run these steps: 1. Let nodes be node’s [children](https://dom.spec.whatwg.org/#concept-tree-child), if node is a `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node); otherwise « node ». + 2. Let count be nodes’s [size](https://infra.spec.whatwg.org/#list-size). + 3. If count is 0, then return. + 4. If node is a `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node), then: - + 1. [Remove](https://dom.spec.whatwg.org/#concept-node-remove) its [children](https://dom.spec.whatwg.org/#concept-tree-child) with the _suppress observers flag_ set. + 2. [Queue a tree mutation record](https://dom.spec.whatwg.org/#queue-a-tree-mutation-record) for node with « », nodes, null, and null. - + This step intentionally does not pay attention to the _suppress observers flag_. - + 5. If child is non-null, then: - + 1. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is parent and [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) is greater than child’s [index](https://dom.spec.whatwg.org/#concept-tree-index), increase its [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) by count. + 2. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [end node](https://dom.spec.whatwg.org/#concept-range-end-node) is parent and [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) is greater than child’s [index](https://dom.spec.whatwg.org/#concept-tree-index), increase its [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) by count. - + 6. Let previousSibling be child’s [previous sibling](https://dom.spec.whatwg.org/#concept-tree-previous-sibling) or parent’s [last child](https://dom.spec.whatwg.org/#concept-tree-last-child) if child is null. + 7. For each node in nodes, in [tree order](https://dom.spec.whatwg.org/#concept-tree-order): - + 1. [Adopt](https://dom.spec.whatwg.org/#concept-node-adopt) node into parent’s [node document](https://dom.spec.whatwg.org/#concept-node-document). + 2. If child is null, then [append](https://infra.spec.whatwg.org/#set-append) node to parent’s [children](https://dom.spec.whatwg.org/#concept-tree-child). + 3. Otherwise, [insert](https://infra.spec.whatwg.org/#list-insert) node into parent’s [children](https://dom.spec.whatwg.org/#concept-tree-child) before child’s [index](https://dom.spec.whatwg.org/#concept-tree-index). + 4. If parent is a [shadow host](https://dom.spec.whatwg.org/#element-shadow-host) whose [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root)’s [slot assignment](https://dom.spec.whatwg.org/#shadowroot-slot-assignment) is "`named`" and node is a [slottable](https://dom.spec.whatwg.org/#concept-slotable), then [assign a slot](https://dom.spec.whatwg.org/#assign-a-slot) for node. + 5. If parent’s [root](https://dom.spec.whatwg.org/#concept-tree-root) is a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root), and parent is a [slot](https://dom.spec.whatwg.org/#concept-slot) whose [assigned nodes](https://dom.spec.whatwg.org/#slot-assigned-nodes) is the empty list, then run [signal a slot change](https://dom.spec.whatwg.org/#signal-a-slot-change) for parent. + 6. Run [assign slottables for a tree](https://dom.spec.whatwg.org/#assign-slotables-for-a-tree) with node’s [root](https://dom.spec.whatwg.org/#concept-tree-root). + 7. For each [shadow-including inclusive descendant](https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-descendant) inclusiveDescendant of node, in [shadow-including tree order](https://dom.spec.whatwg.org/#concept-shadow-including-tree-order): - + 1. Run the [insertion steps](https://dom.spec.whatwg.org/#concept-node-insert-ext) with inclusiveDescendant. + 2. If inclusiveDescendant is [connected](https://dom.spec.whatwg.org/#connected), then: - + 1. If inclusiveDescendant is [custom](https://dom.spec.whatwg.org/#concept-element-custom), then [enqueue a custom element callback reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction) with inclusiveDescendant, callback name "`connectedCallback`", and an empty argument list. + 2. Otherwise, [try to upgrade](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-try-upgrade) inclusiveDescendant. - + If this successfully upgrades inclusiveDescendant, its `connectedCallback` will be enqueued automatically during the [upgrade an element](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-upgrade-an-element) algorithm. - + 8. If _suppress observers flag_ is unset, then [queue a tree mutation record](https://dom.spec.whatwg.org/#queue-a-tree-mutation-record) for parent with nodes, « », previousSibling, and child. + 9. Run the [children changed steps](https://dom.spec.whatwg.org/#concept-node-children-changed-ext) for parent. + To append a node to a parent, [pre-insert](https://dom.spec.whatwg.org/#concept-node-pre-insert) node into parent before null. To replace a child with node within a parent, run these steps: 1. If parent is not a `[Document](https://dom.spec.whatwg.org/#document)`, `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)`, or `[Element](https://dom.spec.whatwg.org/#element)` [node](https://dom.spec.whatwg.org/#concept-node), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. If node is a [host-including inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-host-including-inclusive-ancestor) of parent, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 3. If child’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is not parent, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotFoundError](https://webidl.spec.whatwg.org/#notfounderror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 4. If node is not a `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)`, `[DocumentType](https://dom.spec.whatwg.org/#documenttype)`, `[Element](https://dom.spec.whatwg.org/#element)`, or `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 5. If either node is a `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node) and parent is a [document](https://dom.spec.whatwg.org/#concept-document), or node is a [doctype](https://dom.spec.whatwg.org/#concept-doctype) and parent is not a [document](https://dom.spec.whatwg.org/#concept-document), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 6. If parent is a [document](https://dom.spec.whatwg.org/#concept-document), and any of the statements below, switched on the interface node [implements](https://webidl.spec.whatwg.org/#implements), are true, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. - + `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` - + If node has more than one [element](https://dom.spec.whatwg.org/#concept-element) [child](https://dom.spec.whatwg.org/#concept-tree-child) or has a `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node) [child](https://dom.spec.whatwg.org/#concept-tree-child). - + Otherwise, if node has one [element](https://dom.spec.whatwg.org/#concept-element) [child](https://dom.spec.whatwg.org/#concept-tree-child) and either parent has an [element](https://dom.spec.whatwg.org/#concept-element) [child](https://dom.spec.whatwg.org/#concept-tree-child) that is not child or a [doctype](https://dom.spec.whatwg.org/#concept-doctype) is [following](https://dom.spec.whatwg.org/#concept-tree-following) child. - + `[Element](https://dom.spec.whatwg.org/#element)` - + parent has an [element](https://dom.spec.whatwg.org/#concept-element) [child](https://dom.spec.whatwg.org/#concept-tree-child) that is not child or a [doctype](https://dom.spec.whatwg.org/#concept-doctype) is [following](https://dom.spec.whatwg.org/#concept-tree-following) child. - + `[DocumentType](https://dom.spec.whatwg.org/#documenttype)` - + parent has a [doctype](https://dom.spec.whatwg.org/#concept-doctype) [child](https://dom.spec.whatwg.org/#concept-tree-child) that is not child, or an [element](https://dom.spec.whatwg.org/#concept-element) is [preceding](https://dom.spec.whatwg.org/#concept-tree-preceding) child. - + The above statements differ from the [pre-insert](https://dom.spec.whatwg.org/#concept-node-pre-insert) algorithm. - + 7. Let referenceChild be child’s [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling). + 8. If referenceChild is node, then set referenceChild to node’s [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling). + 9. Let previousSibling be child’s [previous sibling](https://dom.spec.whatwg.org/#concept-tree-previous-sibling). -10. Let removedNodes be the empty set. - -11. If child’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is non-null, then: - -12. Set removedNodes to « child ». -13. [Remove](https://dom.spec.whatwg.org/#concept-node-remove) child with the _suppress observers flag_ set. - + +10. Let removedNodes be the empty set. + +11. If child’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is non-null, then: + + 1. Set removedNodes to « child ». + + 2. [Remove](https://dom.spec.whatwg.org/#concept-node-remove) child with the _suppress observers flag_ set. + + The above can only be false if child is node. - -14. Let nodes be node’s [children](https://dom.spec.whatwg.org/#concept-tree-child) if node is a `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node); otherwise « node ». - -15. [Insert](https://dom.spec.whatwg.org/#concept-node-insert) node into parent before referenceChild with the _suppress observers flag_ set. - -16. [Queue a tree mutation record](https://dom.spec.whatwg.org/#queue-a-tree-mutation-record) for parent with nodes, removedNodes, previousSibling, and referenceChild. - -17. Return child. + +12. Let nodes be node’s [children](https://dom.spec.whatwg.org/#concept-tree-child) if node is a `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node); otherwise « node ». + +13. [Insert](https://dom.spec.whatwg.org/#concept-node-insert) node into parent before referenceChild with the _suppress observers flag_ set. + +14. [Queue a tree mutation record](https://dom.spec.whatwg.org/#queue-a-tree-mutation-record) for parent with nodes, removedNodes, previousSibling, and referenceChild. + +15. Return child. + To replace all with a node within a parent, run these steps: 1. Let removedNodes be parent’s [children](https://dom.spec.whatwg.org/#concept-tree-child). + 2. Let addedNodes be the empty set. + 3. If node is a `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node), then set addedNodes to node’s [children](https://dom.spec.whatwg.org/#concept-tree-child). + 4. Otherwise, if node is non-null, set addedNodes to « node ». + 5. [Remove](https://dom.spec.whatwg.org/#concept-node-remove) all parent’s [children](https://dom.spec.whatwg.org/#concept-tree-child), in [tree order](https://dom.spec.whatwg.org/#concept-tree-order), with the _suppress observers flag_ set. + 6. If node is non-null, then [insert](https://dom.spec.whatwg.org/#concept-node-insert) node into parent before null with the _suppress observers flag_ set. + 7. If either addedNodes or removedNodes [is not empty](https://infra.spec.whatwg.org/#list-is-empty), then [queue a tree mutation record](https://dom.spec.whatwg.org/#queue-a-tree-mutation-record) for parent with addedNodes, removedNodes, null, and null. + This algorithm does not make any checks with regards to the [node tree](https://dom.spec.whatwg.org/#concept-node-tree) constraints. Specification authors need to use it wisely. To pre-remove a child from a parent, run these steps: 1. If child’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is not parent, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotFoundError](https://webidl.spec.whatwg.org/#notfounderror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. [Remove](https://dom.spec.whatwg.org/#concept-node-remove) child. + 3. Return child. + [Specifications](https://dom.spec.whatwg.org/#other-applicable-specifications) may define removing steps for all or some [nodes](https://dom.spec.whatwg.org/#concept-node). The algorithm is passed removedNode, and optionally oldParent, as indicated in the [remove](https://dom.spec.whatwg.org/#concept-node-remove) algorithm below. To remove a node, with an optional _suppress observers flag_, run these steps: 1. Let parent be node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) + 2. Assert: parent is non-null. + 3. Let index be node’s [index](https://dom.spec.whatwg.org/#concept-tree-index). + 4. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is an [inclusive descendant](https://dom.spec.whatwg.org/#concept-tree-inclusive-descendant) of node, set its [start](https://dom.spec.whatwg.org/#concept-range-start) to (parent, index). + 5. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [end node](https://dom.spec.whatwg.org/#concept-range-end-node) is an [inclusive descendant](https://dom.spec.whatwg.org/#concept-tree-inclusive-descendant) of node, set its [end](https://dom.spec.whatwg.org/#concept-range-end) to (parent, index). + 6. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is parent and [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) is greater than index, decrease its [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) by 1. + 7. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [end node](https://dom.spec.whatwg.org/#concept-range-end-node) is parent and [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) is greater than index, decrease its [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) by 1. + 8. For each `[NodeIterator](https://dom.spec.whatwg.org/#nodeiterator)` object iterator whose [root](https://dom.spec.whatwg.org/#concept-traversal-root)’s [node document](https://dom.spec.whatwg.org/#concept-node-document) is node’s [node document](https://dom.spec.whatwg.org/#concept-node-document), run the [`NodeIterator` pre-removing steps](https://dom.spec.whatwg.org/#nodeiterator-pre-removing-steps) given node and iterator. + 9. Let oldPreviousSibling be node’s [previous sibling](https://dom.spec.whatwg.org/#concept-tree-previous-sibling). -10. Let oldNextSibling be node’s [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling). - -11. [Remove](https://infra.spec.whatwg.org/#list-remove) node from its parent’s [children](https://dom.spec.whatwg.org/#concept-tree-child). - -12. If node is [assigned](https://dom.spec.whatwg.org/#slotable-assigned), then run [assign slottables](https://dom.spec.whatwg.org/#assign-slotables) for node’s [assigned slot](https://dom.spec.whatwg.org/#slotable-assigned-slot). - -13. If parent’s [root](https://dom.spec.whatwg.org/#concept-tree-root) is a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root), and parent is a [slot](https://dom.spec.whatwg.org/#concept-slot) whose [assigned nodes](https://dom.spec.whatwg.org/#slot-assigned-nodes) is the empty list, then run [signal a slot change](https://dom.spec.whatwg.org/#signal-a-slot-change) for parent. - -14. If node has an [inclusive descendant](https://dom.spec.whatwg.org/#concept-tree-inclusive-descendant) that is a [slot](https://dom.spec.whatwg.org/#concept-slot), then: - -15. Run [assign slottables for a tree](https://dom.spec.whatwg.org/#assign-slotables-for-a-tree) with parent’s [root](https://dom.spec.whatwg.org/#concept-tree-root). -16. Run [assign slottables for a tree](https://dom.spec.whatwg.org/#assign-slotables-for-a-tree) with node. -17. Run the [removing steps](https://dom.spec.whatwg.org/#concept-node-remove-ext) with node and parent. - -18. Let isParentConnected be parent’s [connected](https://dom.spec.whatwg.org/#connected). - -19. If node is [custom](https://dom.spec.whatwg.org/#concept-element-custom) and isParentConnected is true, then [enqueue a custom element callback reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction) with node, callback name "`disconnectedCallback`", and an empty argument list. - + +10. Let oldNextSibling be node’s [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling). + +11. [Remove](https://infra.spec.whatwg.org/#list-remove) node from its parent’s [children](https://dom.spec.whatwg.org/#concept-tree-child). + +12. If node is [assigned](https://dom.spec.whatwg.org/#slotable-assigned), then run [assign slottables](https://dom.spec.whatwg.org/#assign-slotables) for node’s [assigned slot](https://dom.spec.whatwg.org/#slotable-assigned-slot). + +13. If parent’s [root](https://dom.spec.whatwg.org/#concept-tree-root) is a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root), and parent is a [slot](https://dom.spec.whatwg.org/#concept-slot) whose [assigned nodes](https://dom.spec.whatwg.org/#slot-assigned-nodes) is the empty list, then run [signal a slot change](https://dom.spec.whatwg.org/#signal-a-slot-change) for parent. + +14. If node has an [inclusive descendant](https://dom.spec.whatwg.org/#concept-tree-inclusive-descendant) that is a [slot](https://dom.spec.whatwg.org/#concept-slot), then: + + 1. Run [assign slottables for a tree](https://dom.spec.whatwg.org/#assign-slotables-for-a-tree) with parent’s [root](https://dom.spec.whatwg.org/#concept-tree-root). + + 2. Run [assign slottables for a tree](https://dom.spec.whatwg.org/#assign-slotables-for-a-tree) with node. + +15. Run the [removing steps](https://dom.spec.whatwg.org/#concept-node-remove-ext) with node and parent. + +16. Let isParentConnected be parent’s [connected](https://dom.spec.whatwg.org/#connected). + +17. If node is [custom](https://dom.spec.whatwg.org/#concept-element-custom) and isParentConnected is true, then [enqueue a custom element callback reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction) with node, callback name "`disconnectedCallback`", and an empty argument list. + It is intentional for now that [custom](https://dom.spec.whatwg.org/#concept-element-custom) [elements](https://dom.spec.whatwg.org/#concept-element) do not get parent passed. This might change in the future if there is a need. - -20. For each [shadow-including descendant](https://dom.spec.whatwg.org/#concept-shadow-including-descendant) descendant of node, in [shadow-including tree order](https://dom.spec.whatwg.org/#concept-shadow-including-tree-order), then: - -21. Run the [removing steps](https://dom.spec.whatwg.org/#concept-node-remove-ext) with descendant. -22. If descendant is [custom](https://dom.spec.whatwg.org/#concept-element-custom) and isParentConnected is true, then [enqueue a custom element callback reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction) with descendant, callback name "`disconnectedCallback`", and an empty argument list. -23. For each [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) inclusiveAncestor of parent, and then [for each](https://infra.spec.whatwg.org/#list-iterate) registered of inclusiveAncestor’s [registered observer list](https://dom.spec.whatwg.org/#registered-observer-list), if registered’s [options](https://dom.spec.whatwg.org/#registered-observer-options)\["`[subtree](https://dom.spec.whatwg.org/#dom-mutationobserverinit-subtree)`"\] is true, then [append](https://infra.spec.whatwg.org/#list-append) a new [transient registered observer](https://dom.spec.whatwg.org/#transient-registered-observer) whose [observer](https://dom.spec.whatwg.org/#registered-observer-observer) is registered’s [observer](https://dom.spec.whatwg.org/#registered-observer-observer), [options](https://dom.spec.whatwg.org/#registered-observer-options) is registered’s [options](https://dom.spec.whatwg.org/#registered-observer-options), and [source](https://dom.spec.whatwg.org/#transient-registered-observer-source) is registered to node’s [registered observer list](https://dom.spec.whatwg.org/#registered-observer-list). - -24. If _suppress observers flag_ is unset, then [queue a tree mutation record](https://dom.spec.whatwg.org/#queue-a-tree-mutation-record) for parent with « », « node », oldPreviousSibling, and oldNextSibling. - -25. Run the [children changed steps](https://dom.spec.whatwg.org/#concept-node-children-changed-ext) for parent. + +18. For each [shadow-including descendant](https://dom.spec.whatwg.org/#concept-shadow-including-descendant) descendant of node, in [shadow-including tree order](https://dom.spec.whatwg.org/#concept-shadow-including-tree-order), then: + + 1. Run the [removing steps](https://dom.spec.whatwg.org/#concept-node-remove-ext) with descendant. + + 2. If descendant is [custom](https://dom.spec.whatwg.org/#concept-element-custom) and isParentConnected is true, then [enqueue a custom element callback reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction) with descendant, callback name "`disconnectedCallback`", and an empty argument list. + +19. For each [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) inclusiveAncestor of parent, and then [for each](https://infra.spec.whatwg.org/#list-iterate) registered of inclusiveAncestor’s [registered observer list](https://dom.spec.whatwg.org/#registered-observer-list), if registered’s [options](https://dom.spec.whatwg.org/#registered-observer-options)\["`[subtree](https://dom.spec.whatwg.org/#dom-mutationobserverinit-subtree)`"\] is true, then [append](https://infra.spec.whatwg.org/#list-append) a new [transient registered observer](https://dom.spec.whatwg.org/#transient-registered-observer) whose [observer](https://dom.spec.whatwg.org/#registered-observer-observer) is registered’s [observer](https://dom.spec.whatwg.org/#registered-observer-observer), [options](https://dom.spec.whatwg.org/#registered-observer-options) is registered’s [options](https://dom.spec.whatwg.org/#registered-observer-options), and [source](https://dom.spec.whatwg.org/#transient-registered-observer-source) is registered to node’s [registered observer list](https://dom.spec.whatwg.org/#registered-observer-list). + +20. If _suppress observers flag_ is unset, then [queue a tree mutation record](https://dom.spec.whatwg.org/#queue-a-tree-mutation-record) for parent with « », « node », oldPreviousSibling, and oldNextSibling. + +21. Run the [children changed steps](https://dom.spec.whatwg.org/#concept-node-children-changed-ext) for parent. + #### 4.2.4. Mixin `[NonElementParentNode](https://dom.spec.whatwg.org/#nonelementparentnode)`[](https://dom.spec.whatwg.org/#interface-nonelementparentnode) Web compatibility prevents the `[getElementById()](https://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid)` method from being exposed on [elements](https://dom.spec.whatwg.org/#concept-element) (and therefore on `[ParentNode](https://dom.spec.whatwg.org/#parentnode)`). interface mixin `NonElementParentNode` { -[Element](https://dom.spec.whatwg.org/#element)? [getElementById](https://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `elementId`[](https://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid-elementid-elementid)); + [Element](https://dom.spec.whatwg.org/#element)? [getElementById](https://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `elementId`[](https://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid-elementid-elementid)); }; [Document](https://dom.spec.whatwg.org/#document) includes [NonElementParentNode](https://dom.spec.whatwg.org/#nonelementparentnode); [DocumentFragment](https://dom.spec.whatwg.org/#documentfragment) includes [NonElementParentNode](https://dom.spec.whatwg.org/#nonelementparentnode); @@ -2230,15 +2499,15 @@ In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE5.5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -2262,83 +2531,88 @@ The `[DocumentOrShadowRoot](https://dom.spec.whatwg.org/#documentorshadowroot)` To convert nodes into a node, given nodes and document, run these steps: 1. Let node be null. + 2. Replace each string in nodes with a new `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node) whose [data](https://dom.spec.whatwg.org/#concept-cd-data) is the string and [node document](https://dom.spec.whatwg.org/#concept-node-document) is document. + 3. If nodes contains one [node](https://dom.spec.whatwg.org/#concept-node), then set node to nodes\[0\]. + 4. Otherwise, set node to a new `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node) whose [node document](https://dom.spec.whatwg.org/#concept-node-document) is document, and then [append](https://dom.spec.whatwg.org/#concept-node-append) each [node](https://dom.spec.whatwg.org/#concept-node) in nodes, if any, to it. + 5. Return node. + interface mixin `ParentNode` { -\[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection) [children](https://dom.spec.whatwg.org/#dom-parentnode-children); -readonly attribute [Element](https://dom.spec.whatwg.org/#element)? [firstElementChild](https://dom.spec.whatwg.org/#dom-parentnode-firstelementchild); -readonly attribute [Element](https://dom.spec.whatwg.org/#element)? [lastElementChild](https://dom.spec.whatwg.org/#dom-parentnode-lastelementchild); -readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [childElementCount](https://dom.spec.whatwg.org/#dom-parentnode-childelementcount); + \[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection) [children](https://dom.spec.whatwg.org/#dom-parentnode-children); + readonly attribute [Element](https://dom.spec.whatwg.org/#element)? [firstElementChild](https://dom.spec.whatwg.org/#dom-parentnode-firstelementchild); + readonly attribute [Element](https://dom.spec.whatwg.org/#element)? [lastElementChild](https://dom.spec.whatwg.org/#dom-parentnode-lastelementchild); + readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [childElementCount](https://dom.spec.whatwg.org/#dom-parentnode-childelementcount); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [prepend](https://dom.spec.whatwg.org/#dom-parentnode-prepend)(([Node](https://dom.spec.whatwg.org/#node) or [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString))... `nodes`[](https://dom.spec.whatwg.org/#dom-parentnode-prepend-nodes-nodes)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [append](https://dom.spec.whatwg.org/#dom-parentnode-append)(([Node](https://dom.spec.whatwg.org/#node) or [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString))... `nodes`[](https://dom.spec.whatwg.org/#dom-parentnode-append-nodes-nodes)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [replaceChildren](https://dom.spec.whatwg.org/#dom-parentnode-replacechildren)(([Node](https://dom.spec.whatwg.org/#node) or [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString))... `nodes`[](https://dom.spec.whatwg.org/#dom-parentnode-replacechildren-nodes-nodes)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [prepend](https://dom.spec.whatwg.org/#dom-parentnode-prepend)(([Node](https://dom.spec.whatwg.org/#node) or [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString))... `nodes`[](https://dom.spec.whatwg.org/#dom-parentnode-prepend-nodes-nodes)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [append](https://dom.spec.whatwg.org/#dom-parentnode-append)(([Node](https://dom.spec.whatwg.org/#node) or [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString))... `nodes`[](https://dom.spec.whatwg.org/#dom-parentnode-append-nodes-nodes)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [replaceChildren](https://dom.spec.whatwg.org/#dom-parentnode-replacechildren)(([Node](https://dom.spec.whatwg.org/#node) or [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString))... `nodes`[](https://dom.spec.whatwg.org/#dom-parentnode-replacechildren-nodes-nodes)); -[Element](https://dom.spec.whatwg.org/#element)? [querySelector](https://dom.spec.whatwg.org/#dom-parentnode-queryselector)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `selectors`[](https://dom.spec.whatwg.org/#dom-parentnode-queryselector-selectors-selectors)); -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [NodeList](https://dom.spec.whatwg.org/#nodelist) [querySelectorAll](https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `selectors`[](https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall-selectors-selectors)); + [Element](https://dom.spec.whatwg.org/#element)? [querySelector](https://dom.spec.whatwg.org/#dom-parentnode-queryselector)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `selectors`[](https://dom.spec.whatwg.org/#dom-parentnode-queryselector-selectors-selectors)); + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [NodeList](https://dom.spec.whatwg.org/#nodelist) [querySelectorAll](https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `selectors`[](https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall-selectors-selectors)); }; [Document](https://dom.spec.whatwg.org/#document) includes [ParentNode](https://dom.spec.whatwg.org/#parentnode); [DocumentFragment](https://dom.spec.whatwg.org/#documentfragment) includes [ParentNode](https://dom.spec.whatwg.org/#parentnode); [Element](https://dom.spec.whatwg.org/#element) includes [ParentNode](https://dom.spec.whatwg.org/#parentnode); -[Document/children](https://developer.mozilla.org/en-US/docs/Web/API/Document/children 'The read-only children property returns a live HTMLCollection which contains all of the child elements of the document upon which it was called.') +[Document/children](https://developer.mozilla.org/en-US/docs/Web/API/Document/children "The read-only children property returns a live HTMLCollection which contains all of the child elements of the document upon which it was called.") In all current engines. Firefox25+Safari9+Chrome29+ ---- +___ Opera16+Edge79+ ---- +___ Edge (Legacy)16+IENone ---- +___ Firefox for Android25+iOS Safari9+Chrome for Android29+Android WebView37+Samsung Internet2.0+Opera Mobile16+ -[DocumentFragment/children](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/children 'The read-only children property returns a live HTMLCollection which contains all of the child elements of the document fragment upon which it was called.') +[DocumentFragment/children](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/children "The read-only children property returns a live HTMLCollection which contains all of the child elements of the document fragment upon which it was called.") In all current engines. Firefox25+Safari9+Chrome29+ ---- +___ Opera16+Edge79+ ---- +___ Edge (Legacy)16+IENone ---- +___ Firefox for Android25+iOS Safari9+Chrome for Android29+Android WebView37+Samsung Internet2.0+Opera Mobile16+ -[Element/children](https://developer.mozilla.org/en-US/docs/Web/API/Element/children 'The read-only children property returns a live HTMLCollection which contains all of the child elements of the element upon which it was called.') +[Element/children](https://developer.mozilla.org/en-US/docs/Web/API/Element/children "The read-only children property returns a live HTMLCollection which contains all of the child elements of the element upon which it was called.") In all current engines. Firefox3.5+Safari4+Chrome1+ ---- +___ Opera10+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile10.1+ -`` collection = node . `[children](https://dom.spec.whatwg.org/#dom-parentnode-children)` `` +``collection = node . `[children](https://dom.spec.whatwg.org/#dom-parentnode-children)` `` Returns the [child](https://dom.spec.whatwg.org/#concept-tree-child) [elements](https://dom.spec.whatwg.org/#concept-element). @@ -2348,15 +2622,15 @@ In all current engines. Firefox25+Safari9+Chrome29+ ---- +___ Opera16+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android25+iOS Safari9+Chrome for Android29+Android WebView37+Samsung Internet2.0+Opera Mobile16+ @@ -2366,15 +2640,15 @@ In all current engines. Firefox25+Safari9+Chrome29+ ---- +___ Opera16+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android25+iOS Safari9+Chrome for Android29+Android WebView37+Samsung Internet2.0+Opera Mobile16+ @@ -2384,19 +2658,19 @@ In all current engines. Firefox3.5+Safari4+Chrome1+ ---- +___ Opera10+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile10.1+ -`` element = node . `[firstElementChild](https://dom.spec.whatwg.org/#dom-parentnode-firstelementchild)` `` +``element = node . `[firstElementChild](https://dom.spec.whatwg.org/#dom-parentnode-firstelementchild)` `` Returns the first [child](https://dom.spec.whatwg.org/#concept-tree-child) that is an [element](https://dom.spec.whatwg.org/#concept-element); otherwise null. @@ -2406,15 +2680,15 @@ In all current engines. Firefox25+Safari9+Chrome29+ ---- +___ Opera16+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android25+iOS Safari9+Chrome for Android29+Android WebView37+Samsung Internet2.0+Opera Mobile16+ @@ -2424,15 +2698,15 @@ In all current engines. Firefox25+Safari9+Chrome29+ ---- +___ Opera16+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android25+iOS Safari9+Chrome for Android29+Android WebView37+Samsung Internet2.0+Opera Mobile16+ @@ -2442,73 +2716,73 @@ In all current engines. Firefox3.5+Safari4+Chrome1+ ---- +___ Opera10+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile10.1+ -`` element = node . `[lastElementChild](https://dom.spec.whatwg.org/#dom-parentnode-lastelementchild)` `` +``element = node . `[lastElementChild](https://dom.spec.whatwg.org/#dom-parentnode-lastelementchild)` `` Returns the last [child](https://dom.spec.whatwg.org/#concept-tree-child) that is an [element](https://dom.spec.whatwg.org/#concept-element); otherwise null. -[Document/prepend](https://developer.mozilla.org/en-US/docs/Web/API/Document/prepend 'The Document.prepend() method inserts a set of Node objects or DOMString objects before the first child of the document. DOMString objects are inserted as equivalent Text nodes.') +[Document/prepend](https://developer.mozilla.org/en-US/docs/Web/API/Document/prepend "The Document.prepend() method inserts a set of Node objects or DOMString objects before the first child of the document. DOMString objects are inserted as equivalent Text nodes.") In all current engines. Firefox49+Safari10+Chrome54+ ---- +___ Opera41+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ -[DocumentFragment/prepend](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/prepend 'The DocumentFragment.prepend() method inserts a set of Node objects or DOMString objects before the first child of the document fragment. DOMString objects are inserted as equivalent Text nodes.') +[DocumentFragment/prepend](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/prepend "The DocumentFragment.prepend() method inserts a set of Node objects or DOMString objects before the first child of the document fragment. DOMString objects are inserted as equivalent Text nodes.") In all current engines. Firefox49+Safari10+Chrome54+ ---- +___ Opera41+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ -[Element/prepend](https://developer.mozilla.org/en-US/docs/Web/API/Element/prepend 'The Element.prepend() method inserts a set of Node objects or DOMString objects before the first child of the Element. DOMString objects are inserted as equivalent Text nodes.') +[Element/prepend](https://developer.mozilla.org/en-US/docs/Web/API/Element/prepend "The Element.prepend() method inserts a set of Node objects or DOMString objects before the first child of the Element. DOMString objects are inserted as equivalent Text nodes.") In all current engines. Firefox49+Safari10+Chrome54+ ---- +___ Opera41+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ @@ -2518,57 +2792,57 @@ Inserts nodes before the [first child](https://dom.spec.whatwg.org/#concept-tree [Throws](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if the constraints of the [node tree](https://dom.spec.whatwg.org/#concept-node-tree) are violated. -[Document/append](https://developer.mozilla.org/en-US/docs/Web/API/Document/append 'The Document.append() method inserts a set of Node objects or DOMString objects after the last child of the document. DOMString objects are inserted as equivalent Text nodes.') +[Document/append](https://developer.mozilla.org/en-US/docs/Web/API/Document/append "The Document.append() method inserts a set of Node objects or DOMString objects after the last child of the document. DOMString objects are inserted as equivalent Text nodes.") In all current engines. Firefox49+Safari10+Chrome54+ ---- +___ Opera41+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ -[DocumentFragment/append](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/append 'The DocumentFragment.append() method inserts a set of Node objects or DOMString objects after the last child of the document fragment. DOMString objects are inserted as equivalent Text nodes.') +[DocumentFragment/append](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/append "The DocumentFragment.append() method inserts a set of Node objects or DOMString objects after the last child of the document fragment. DOMString objects are inserted as equivalent Text nodes.") In all current engines. Firefox49+Safari10+Chrome54+ ---- +___ Opera41+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ -[Element/append](https://developer.mozilla.org/en-US/docs/Web/API/Element/append 'The Element.append() method inserts a set of Node objects or DOMString objects after the last child of the Element. DOMString objects are inserted as equivalent Text nodes.') +[Element/append](https://developer.mozilla.org/en-US/docs/Web/API/Element/append "The Element.append() method inserts a set of Node objects or DOMString objects after the last child of the Element. DOMString objects are inserted as equivalent Text nodes.") In all current engines. Firefox49+Safari10+Chrome54+ ---- +___ Opera41+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ @@ -2578,57 +2852,57 @@ Inserts nodes after the [last child](https://dom.spec.whatwg.org/#concept-tree-l [Throws](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if the constraints of the [node tree](https://dom.spec.whatwg.org/#concept-node-tree) are violated. -[Document/replaceChildren](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren 'The Document.replaceChildren() method replaces the existing children of a Document with a specified new set of children.') +[Document/replaceChildren](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren "The Document.replaceChildren() method replaces the existing children of a Document with a specified new set of children.") In all current engines. Firefox78+Safari14+Chrome86+ ---- +___ Opera72+Edge86+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android79+iOS Safari14+Chrome for Android86+Android WebView86+Samsung Internet14.0+Opera Mobile61+ -[DocumentFragment/replaceChildren](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren 'The DocumentFragment.replaceChildren() method replaces the existing children of a DocumentFragment with a specified new set of children. These can be DOMString or Node objects.') +[DocumentFragment/replaceChildren](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren "The DocumentFragment.replaceChildren() method replaces the existing children of a DocumentFragment with a specified new set of children. These can be DOMString or Node objects.") In all current engines. Firefox78+Safari14+Chrome86+ ---- +___ Opera72+Edge86+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android79+iOS Safari14+Chrome for Android86+Android WebView86+Samsung Internet14.0+Opera Mobile61+ -[Element/replaceChildren](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren 'The Element.replaceChildren() method replaces the existing children of a Node with a specified new set of children. These can be DOMString or Node objects.') +[Element/replaceChildren](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren "The Element.replaceChildren() method replaces the existing children of a Node with a specified new set of children. These can be DOMString or Node objects.") In all current engines. Firefox78+Safari14+Chrome86+ ---- +___ Opera72+Edge86+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android79+iOS Safari14+Chrome for Android86+Android WebView86+Samsung Internet14.0+Opera Mobile61+ @@ -2638,21 +2912,21 @@ Replace all [children](https://dom.spec.whatwg.org/#concept-tree-child) of node [Throws](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if the constraints of the [node tree](https://dom.spec.whatwg.org/#concept-node-tree) are violated. -[Document/querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector 'The Document method querySelector() returns the first Element within the document that matches the specified selector, or group of selectors. If no matches are found, null is returned.') +[Document/querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector "The Document method querySelector() returns the first Element within the document that matches the specified selector, or group of selectors. If no matches are found, null is returned.") In all current engines. Firefox3.5+Safari3.1+Chrome1+ ---- +___ Opera10+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari2+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -2662,15 +2936,15 @@ In all current engines. Firefox3.5+Safari4+Chrome1+ ---- +___ Opera10+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile10.1+ @@ -2684,15 +2958,15 @@ In all current engines. Firefox3.5+Safari3.1+Chrome1+ ---- +___ Opera10+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari2+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -2702,51 +2976,51 @@ In all current engines. Firefox3.5+Safari4+Chrome1+ ---- +___ Opera10+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile10.1+ -[Element/querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector '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.') +[Element/querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector "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.") In all current engines. Firefox3.5+Safari3.1+Chrome1+ ---- +___ Opera10+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari2+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ -[Element/querySelectorAll](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll '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.') +[Element/querySelectorAll](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll "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.") In all current engines. Firefox3.5+Safari3.1+Chrome1+ ---- +___ Opera10+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari2+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -2760,57 +3034,57 @@ The `firstElementChild` getter steps are to return the first [child](https://dom The `lastElementChild` getter steps are to return the last [child](https://dom.spec.whatwg.org/#concept-tree-child) that is an [element](https://dom.spec.whatwg.org/#concept-element); otherwise null. -[Document/childElementCount](https://developer.mozilla.org/en-US/docs/Web/API/Document/childElementCount 'The Document.childElementCount read-only property returns the number of child elements of the document.') +[Document/childElementCount](https://developer.mozilla.org/en-US/docs/Web/API/Document/childElementCount "The Document.childElementCount read-only property returns the number of child elements of the document.") In all current engines. Firefox25+Safari9+Chrome29+ ---- +___ Opera16+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android25+iOS Safari9+Chrome for Android29+Android WebView37+Samsung Internet2.0+Opera Mobile16+ -[DocumentFragment/childElementCount](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/childElementCount 'The Document.childElementCount read-only property returns the number of child elements of a DocumentFragment.') +[DocumentFragment/childElementCount](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/childElementCount "The Document.childElementCount read-only property returns the number of child elements of a DocumentFragment.") In all current engines. Firefox25+Safari9+Chrome29+ ---- +___ Opera16+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android25+iOS Safari9+Chrome for Android29+Android WebView37+Samsung Internet2.0+Opera Mobile16+ -[Element/childElementCount](https://developer.mozilla.org/en-US/docs/Web/API/Element/childElementCount 'The Element.childElementCount read-only property returns the number of child elements of this element.') +[Element/childElementCount](https://developer.mozilla.org/en-US/docs/Web/API/Element/childElementCount "The Element.childElementCount read-only property returns the number of child elements of this element.") In all current engines. Firefox3.5+Safari4+Chrome1+ ---- +___ Opera10+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile10.1+ @@ -2819,18 +3093,25 @@ The `childElementCount` getter steps are to return the number of [children](http The `prepend(nodes)` method steps are: 1. Let node be the result of [converting nodes into a node](https://dom.spec.whatwg.org/#converting-nodes-into-a-node) given nodes and [this](https://webidl.spec.whatwg.org/#this)’s [node document](https://dom.spec.whatwg.org/#concept-node-document). + 2. [Pre-insert](https://dom.spec.whatwg.org/#concept-node-pre-insert) node into [this](https://webidl.spec.whatwg.org/#this) before [this](https://webidl.spec.whatwg.org/#this)’s [first child](https://dom.spec.whatwg.org/#concept-tree-first-child). + The `append(nodes)` method steps are: 1. Let node be the result of [converting nodes into a node](https://dom.spec.whatwg.org/#converting-nodes-into-a-node) given nodes and [this](https://webidl.spec.whatwg.org/#this)’s [node document](https://dom.spec.whatwg.org/#concept-node-document). + 2. [Append](https://dom.spec.whatwg.org/#concept-node-append) node to [this](https://webidl.spec.whatwg.org/#this). + The `replaceChildren(nodes)` method steps are: 1. Let node be the result of [converting nodes into a node](https://dom.spec.whatwg.org/#converting-nodes-into-a-node) given nodes and [this](https://webidl.spec.whatwg.org/#this)’s [node document](https://dom.spec.whatwg.org/#concept-node-document). + 2. [Ensure pre-insertion validity](https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity) of node into [this](https://webidl.spec.whatwg.org/#this) before null. + 3. [Replace all](https://dom.spec.whatwg.org/#concept-node-replace-all) with node within [this](https://webidl.spec.whatwg.org/#this). + The `querySelector(selectors)` method steps are to return the first result of running [scope-match a selectors string](https://dom.spec.whatwg.org/#scope-match-a-selectors-string) selectors against [this](https://webidl.spec.whatwg.org/#this), if the result is not an empty list; otherwise null. @@ -2841,8 +3122,8 @@ The `querySelectorAll(selectors)` method steps are to return the [static](https: Web compatibility prevents the `[previousElementSibling](https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-previouselementsibling)` and `[nextElementSibling](https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-nextelementsibling)` attributes from being exposed on [doctypes](https://dom.spec.whatwg.org/#concept-doctype) (and therefore on `[ChildNode](https://dom.spec.whatwg.org/#childnode)`). interface mixin `NonDocumentTypeChildNode` { -readonly attribute [Element](https://dom.spec.whatwg.org/#element)? [previousElementSibling](https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-previouselementsibling); -readonly attribute [Element](https://dom.spec.whatwg.org/#element)? [nextElementSibling](https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-nextelementsibling); + readonly attribute [Element](https://dom.spec.whatwg.org/#element)? [previousElementSibling](https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-previouselementsibling); + readonly attribute [Element](https://dom.spec.whatwg.org/#element)? [nextElementSibling](https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-nextelementsibling); }; [Element](https://dom.spec.whatwg.org/#element) includes [NonDocumentTypeChildNode](https://dom.spec.whatwg.org/#nondocumenttypechildnode); [CharacterData](https://dom.spec.whatwg.org/#characterdata) includes [NonDocumentTypeChildNode](https://dom.spec.whatwg.org/#nondocumenttypechildnode); @@ -2853,15 +3134,15 @@ In all current engines. Firefox25+Safari9+Chrome29+ ---- +___ Opera16+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android25+iOS Safari9+Chrome for Android29+Android WebView37+Samsung Internet2.0+Opera Mobile16+ @@ -2871,19 +3152,19 @@ In all current engines. Firefox3.5+Safari4+Chrome1+ ---- +___ Opera10+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile10.1+ -`` element = node . `[previousElementSibling](https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-previouselementsibling)` `` +``element = node . `[previousElementSibling](https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-previouselementsibling)` `` Returns the first [preceding](https://dom.spec.whatwg.org/#concept-tree-preceding) [sibling](https://dom.spec.whatwg.org/#concept-tree-sibling) that is an [element](https://dom.spec.whatwg.org/#concept-element); otherwise null. @@ -2893,15 +3174,15 @@ In all current engines. Firefox25+Safari9+Chrome29+ ---- +___ Opera16+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android25+iOS Safari9+Chrome for Android29+Android WebView37+Samsung Internet2.0+Opera Mobile16+ @@ -2911,19 +3192,19 @@ In all current engines. Firefox3.5+Safari4+Chrome1+ ---- +___ Opera10+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile10.1+ -`` element = node . `[nextElementSibling](https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-nextelementsibling)` `` +``element = node . `[nextElementSibling](https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-nextelementsibling)` `` Returns the first [following](https://dom.spec.whatwg.org/#concept-tree-following) [sibling](https://dom.spec.whatwg.org/#concept-tree-sibling) that is an [element](https://dom.spec.whatwg.org/#concept-element); otherwise null. @@ -2934,10 +3215,10 @@ The `nextElementSibling` getter steps are to return the first [following](https: #### 4.2.8. Mixin `[ChildNode](https://dom.spec.whatwg.org/#childnode)`[](https://dom.spec.whatwg.org/#interface-childnode) interface mixin `ChildNode` { -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [before](https://dom.spec.whatwg.org/#dom-childnode-before)(([Node](https://dom.spec.whatwg.org/#node) or [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString))... `nodes`[](https://dom.spec.whatwg.org/#dom-childnode-before-nodes-nodes)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [after](https://dom.spec.whatwg.org/#dom-childnode-after)(([Node](https://dom.spec.whatwg.org/#node) or [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString))... `nodes`[](https://dom.spec.whatwg.org/#dom-childnode-after-nodes-nodes)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [replaceWith](https://dom.spec.whatwg.org/#dom-childnode-replacewith)(([Node](https://dom.spec.whatwg.org/#node) or [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString))... `nodes`[](https://dom.spec.whatwg.org/#dom-childnode-replacewith-nodes-nodes)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [remove](https://dom.spec.whatwg.org/#dom-childnode-remove)(); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [before](https://dom.spec.whatwg.org/#dom-childnode-before)(([Node](https://dom.spec.whatwg.org/#node) or [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString))... `nodes`[](https://dom.spec.whatwg.org/#dom-childnode-before-nodes-nodes)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [after](https://dom.spec.whatwg.org/#dom-childnode-after)(([Node](https://dom.spec.whatwg.org/#node) or [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString))... `nodes`[](https://dom.spec.whatwg.org/#dom-childnode-after-nodes-nodes)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [replaceWith](https://dom.spec.whatwg.org/#dom-childnode-replacewith)(([Node](https://dom.spec.whatwg.org/#node) or [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString))... `nodes`[](https://dom.spec.whatwg.org/#dom-childnode-replacewith-nodes-nodes)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [remove](https://dom.spec.whatwg.org/#dom-childnode-remove)(); }; [DocumentType](https://dom.spec.whatwg.org/#documenttype) includes [ChildNode](https://dom.spec.whatwg.org/#childnode); [Element](https://dom.spec.whatwg.org/#element) includes [ChildNode](https://dom.spec.whatwg.org/#childnode); @@ -2949,15 +3230,15 @@ In all current engines. Firefox49+Safari10+Chrome54+ ---- +___ Opera39+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ @@ -2967,15 +3248,15 @@ In all current engines. Firefox49+Safari10+Chrome54+ ---- +___ Opera39+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ @@ -2985,19 +3266,19 @@ In all current engines. Firefox49+Safari10+Chrome54+ ---- +___ Opera39+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ -`` node . `[before(...nodes)](https://dom.spec.whatwg.org/#dom-childnode-before)` `` +``node . `[before(...nodes)](https://dom.spec.whatwg.org/#dom-childnode-before)` `` Inserts nodes just before node, while replacing strings in nodes with equivalent `[Text](https://dom.spec.whatwg.org/#text)` [nodes](https://dom.spec.whatwg.org/#concept-node). @@ -3009,15 +3290,15 @@ In all current engines. Firefox49+Safari10+Chrome54+ ---- +___ Opera39+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ @@ -3027,15 +3308,15 @@ In all current engines. Firefox49+Safari10+Chrome54+ ---- +___ Opera39+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ @@ -3045,99 +3326,99 @@ In all current engines. Firefox49+Safari10+Chrome54+ ---- +___ Opera39+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ -`` node . `[after(...nodes)](https://dom.spec.whatwg.org/#dom-childnode-after)` `` +``node . `[after(...nodes)](https://dom.spec.whatwg.org/#dom-childnode-after)` `` Inserts nodes just after node, while replacing strings in nodes with equivalent `[Text](https://dom.spec.whatwg.org/#text)` [nodes](https://dom.spec.whatwg.org/#concept-node). [Throws](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if the constraints of the [node tree](https://dom.spec.whatwg.org/#concept-node-tree) are violated. -[CharacterData/replaceWith](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/replaceWith '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.') +[CharacterData/replaceWith](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/replaceWith "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.") In all current engines. Firefox49+Safari10+Chrome54+ ---- +___ Opera39+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ -[DocumentType/replaceWith](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/replaceWith 'The DocumentType.replaceWith() method replaces the document type with a set of given nodes.') +[DocumentType/replaceWith](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/replaceWith "The DocumentType.replaceWith() method replaces the document type with a set of given nodes.") In all current engines. Firefox49+Safari10+Chrome54+ ---- +___ Opera39+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ -[Element/replaceWith](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceWith 'The Element.replaceWith() method replaces this Element in the children list of its parent with a set of Node or DOMString objects. DOMString objects are inserted as equivalent Text nodes.') +[Element/replaceWith](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceWith "The Element.replaceWith() method replaces this Element in the children list of its parent with a set of Node or DOMString objects. DOMString objects are inserted as equivalent Text nodes.") In all current engines. Firefox49+Safari10+Chrome54+ ---- +___ Opera39+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ -`` node . `[replaceWith(...nodes)](https://dom.spec.whatwg.org/#dom-childnode-replacewith)` `` +``node . `[replaceWith(...nodes)](https://dom.spec.whatwg.org/#dom-childnode-replacewith)` `` Replaces node with nodes, while replacing strings in nodes with equivalent `[Text](https://dom.spec.whatwg.org/#text)` [nodes](https://dom.spec.whatwg.org/#concept-node). [Throws](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if the constraints of the [node tree](https://dom.spec.whatwg.org/#concept-node-tree) are violated. -[CharacterData/remove](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/remove 'The remove() method of the CharacterData removes the text contained in the node.') +[CharacterData/remove](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/remove "The remove() method of the CharacterData removes the text contained in the node.") In all current engines. Firefox23+Safari7+Chrome24+ ---- +___ Opera15+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android23+iOS Safari7+Chrome for Android25+Android WebView37+Samsung Internet1.5+Opera Mobile14+ @@ -3147,115 +3428,133 @@ In all current engines. Firefox23+Safari7+Chrome24+ ---- +___ Opera15+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android23+iOS Safari7+Chrome for Android25+Android WebView37+Samsung Internet1.5+Opera Mobile14+ -[Element/remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove 'The Element.remove() method removes the element from the tree it belongs to.') +[Element/remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove "The Element.remove() method removes the element from the tree it belongs to.") In all current engines. Firefox23+Safari7+Chrome24+ ---- +___ Opera15+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android23+iOS Safari7+Chrome for Android25+Android WebView37+Samsung Internet1.5+Opera Mobile14+ -`` node . `[remove()](https://dom.spec.whatwg.org/#dom-childnode-remove)` `` +``node . `[remove()](https://dom.spec.whatwg.org/#dom-childnode-remove)` `` Removes node. The `before(nodes)` method steps are: 1. Let parent be [this](https://webidl.spec.whatwg.org/#this)’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent). + 2. If parent is null, then return. + 3. Let viablePreviousSibling be [this](https://webidl.spec.whatwg.org/#this)’s first [preceding](https://dom.spec.whatwg.org/#concept-tree-preceding) [sibling](https://dom.spec.whatwg.org/#concept-tree-sibling) not in nodes; otherwise null. + 4. Let node be the result of [converting nodes into a node](https://dom.spec.whatwg.org/#converting-nodes-into-a-node), given nodes and [this](https://webidl.spec.whatwg.org/#this)’s [node document](https://dom.spec.whatwg.org/#concept-node-document). + 5. If viablePreviousSibling is null, then set it to parent’s [first child](https://dom.spec.whatwg.org/#concept-tree-first-child); otherwise to viablePreviousSibling’s [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling). + 6. [Pre-insert](https://dom.spec.whatwg.org/#concept-node-pre-insert) node into parent before viablePreviousSibling. + The `after(nodes)` method steps are: 1. Let parent be [this](https://webidl.spec.whatwg.org/#this)’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent). + 2. If parent is null, then return. + 3. Let viableNextSibling be [this](https://webidl.spec.whatwg.org/#this)’s first [following](https://dom.spec.whatwg.org/#concept-tree-following) [sibling](https://dom.spec.whatwg.org/#concept-tree-sibling) not in nodes; otherwise null. + 4. Let node be the result of [converting nodes into a node](https://dom.spec.whatwg.org/#converting-nodes-into-a-node), given nodes and [this](https://webidl.spec.whatwg.org/#this)’s [node document](https://dom.spec.whatwg.org/#concept-node-document). + 5. [Pre-insert](https://dom.spec.whatwg.org/#concept-node-pre-insert) node into parent before viableNextSibling. + The `replaceWith(nodes)` method steps are: 1. Let parent be [this](https://webidl.spec.whatwg.org/#this)’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent). + 2. If parent is null, then return. + 3. Let viableNextSibling be [this](https://webidl.spec.whatwg.org/#this)’s first [following](https://dom.spec.whatwg.org/#concept-tree-following) [sibling](https://dom.spec.whatwg.org/#concept-tree-sibling) not in nodes; otherwise null. + 4. Let node be the result of [converting nodes into a node](https://dom.spec.whatwg.org/#converting-nodes-into-a-node), given nodes and [this](https://webidl.spec.whatwg.org/#this)’s [node document](https://dom.spec.whatwg.org/#concept-node-document). + 5. If [this](https://webidl.spec.whatwg.org/#this)’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is parent, [replace](https://dom.spec.whatwg.org/#concept-node-replace) [this](https://webidl.spec.whatwg.org/#this) with node within parent. - + [This](https://webidl.spec.whatwg.org/#this) could have been inserted into node. - + 6. Otherwise, [pre-insert](https://dom.spec.whatwg.org/#concept-node-pre-insert) node into parent before viableNextSibling. + The `remove()` method steps are: 1. If [this](https://webidl.spec.whatwg.org/#this)’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is null, then return. + 2. [Remove](https://dom.spec.whatwg.org/#concept-node-remove) [this](https://webidl.spec.whatwg.org/#this). + #### 4.2.9. Mixin `[Slottable](https://dom.spec.whatwg.org/#slotable)`[](https://dom.spec.whatwg.org/#mixin-slotable) interface mixin `Slottable` { -readonly attribute [HTMLSlotElement](https://html.spec.whatwg.org/multipage/scripting.html#htmlslotelement)? [assignedSlot](https://dom.spec.whatwg.org/#dom-slotable-assignedslot); + readonly attribute [HTMLSlotElement](https://html.spec.whatwg.org/multipage/scripting.html#htmlslotelement)? [assignedSlot](https://dom.spec.whatwg.org/#dom-slotable-assignedslot); }; [Element](https://dom.spec.whatwg.org/#element) includes [Slottable](https://dom.spec.whatwg.org/#slotable); [Text](https://dom.spec.whatwg.org/#text) includes [Slottable](https://dom.spec.whatwg.org/#slotable); -[Element/assignedSlot](https://developer.mozilla.org/en-US/docs/Web/API/Element/assignedSlot 'The assignedSlot read-only property of the Element interface returns an HTMLSlotElement representing the element the node is inserted in.') +[Element/assignedSlot](https://developer.mozilla.org/en-US/docs/Web/API/Element/assignedSlot "The assignedSlot read-only property of the Element interface returns an HTMLSlotElement representing the element the node is inserted in.") In all current engines. Firefox63+Safari10.1+Chrome53+ ---- +___ Opera40+Edge79+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android63+iOS Safari10.3+Chrome for Android53+Android WebView53+Samsung Internet6.0+Opera Mobile41+ -[Text/assignedSlot](https://developer.mozilla.org/en-US/docs/Web/API/Text/assignedSlot 'The read-only assignedSlot property of the Text interface returns the HTMLSlotElement object associated with the element.') +[Text/assignedSlot](https://developer.mozilla.org/en-US/docs/Web/API/Text/assignedSlot "The read-only assignedSlot property of the Text interface returns the HTMLSlotElement object associated with the element.") In all current engines. Firefox63+Safari10.1+Chrome53+ ---- +___ Opera40+Edge79+ ---- +___ Edge (Legacy)18IENone ---- +___ Firefox for Android63+iOS Safari10.3+Chrome for Android53+Android WebView53+Samsung Internet6.0+Opera Mobile41+ @@ -3273,21 +3572,21 @@ The [collection](https://dom.spec.whatwg.org/#concept-collection) then represent ##### 4.2.10.1. Interface `[NodeList](https://dom.spec.whatwg.org/#nodelist)`[](https://dom.spec.whatwg.org/#interface-nodelist) -[NodeList](https://developer.mozilla.org/en-US/docs/Web/API/NodeList 'NodeList objects are collections of nodes, usually returned by properties such as Node.childNodes and methods such as document.querySelectorAll().') +[NodeList](https://developer.mozilla.org/en-US/docs/Web/API/NodeList "NodeList objects are collections of nodes, usually returned by properties such as Node.childNodes and methods such as document.querySelectorAll().") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera8+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -3295,26 +3594,26 @@ A `[NodeList](https://dom.spec.whatwg.org/#nodelist)` object is a [collection](h \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `NodeList` { -getter [Node](https://dom.spec.whatwg.org/#node)? [item](https://dom.spec.whatwg.org/#dom-nodelist-item)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `index`[](https://dom.spec.whatwg.org/#dom-nodelist-item-index-index)); -readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [length](https://dom.spec.whatwg.org/#dom-nodelist-length); -iterable<[Node](https://dom.spec.whatwg.org/#node)\>; + getter [Node](https://dom.spec.whatwg.org/#node)? [item](https://dom.spec.whatwg.org/#dom-nodelist-item)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `index`[](https://dom.spec.whatwg.org/#dom-nodelist-item-index-index)); + readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [length](https://dom.spec.whatwg.org/#dom-nodelist-length); + iterable<[Node](https://dom.spec.whatwg.org/#node)\>; }; -[NodeList/length](https://developer.mozilla.org/en-US/docs/Web/API/NodeList/length 'The NodeList.length property returns the number of items in a NodeList.') +[NodeList/length](https://developer.mozilla.org/en-US/docs/Web/API/NodeList/length "The NodeList.length property returns the number of items in a NodeList.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -3328,15 +3627,15 @@ In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -3348,50 +3647,50 @@ Returns the [node](https://dom.spec.whatwg.org/#concept-node) with index index f ##### 4.2.10.2. Interface `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)`[](https://dom.spec.whatwg.org/#interface-htmlcollection) -[HTMLCollection](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection 'The HTMLCollection interface represents a generic collection (array-like object similar to arguments) of elements (in document order) and offers methods and properties for selecting from the list.') +[HTMLCollection](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection "The HTMLCollection interface represents a generic collection (array-like object similar to arguments) of elements (in document order) and offers methods and properties for selecting from the list.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera8+Edge79+ ---- +___ Edge (Legacy)12+IE8+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window, [LegacyUnenumerableNamedProperties](https://webidl.spec.whatwg.org/#LegacyUnenumerableNamedProperties)\] interface `HTMLCollection` { -readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [length](https://dom.spec.whatwg.org/#dom-htmlcollection-length); -getter [Element](https://dom.spec.whatwg.org/#element)? [item](https://dom.spec.whatwg.org/#dom-htmlcollection-item)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `index`[](https://dom.spec.whatwg.org/#dom-htmlcollection-item-index-index)); -getter [Element](https://dom.spec.whatwg.org/#element)? `namedItem`([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `name`[](https://dom.spec.whatwg.org/#dom-htmlcollection-nameditem-name-name)); + readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [length](https://dom.spec.whatwg.org/#dom-htmlcollection-length); + getter [Element](https://dom.spec.whatwg.org/#element)? [item](https://dom.spec.whatwg.org/#dom-htmlcollection-item)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `index`[](https://dom.spec.whatwg.org/#dom-htmlcollection-item-index-index)); + getter [Element](https://dom.spec.whatwg.org/#element)? `namedItem`([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `name`[](https://dom.spec.whatwg.org/#dom-htmlcollection-nameditem-name-name)); }; An `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` object is a [collection](https://dom.spec.whatwg.org/#concept-collection) of [elements](https://dom.spec.whatwg.org/#concept-element). `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` is a historical artifact we cannot rid the web of. While developers are of course welcome to keep using it, new API standard designers ought not to use it (use `sequence` in IDL instead). -[HTMLCollection/length](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection/length 'The HTMLCollection.length property returns the number of items in a HTMLCollection.') +[HTMLCollection/length](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection/length "The HTMLCollection.length property returns the number of items in a HTMLCollection.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE8+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -3399,21 +3698,21 @@ collection . `[length](https://dom.spec.whatwg.org/#dom-htmlcollection-length)` Returns the number of [elements](https://dom.spec.whatwg.org/#concept-element) in the [collection](https://dom.spec.whatwg.org/#concept-collection). -[HTMLCollection/item](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection/item 'The HTMLCollection method item() returns the node located at the specified offset into the collection.') +[HTMLCollection/item](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection/item "The HTMLCollection method item() returns the node located at the specified offset into the collection.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE8+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -3438,40 +3737,45 @@ The `item(index)` method steps are to return the indexth [element](https://dom.s The [supported property names](https://webidl.spec.whatwg.org/#dfn-supported-property-names) are the values from the list returned by these steps: 1. Let result be an empty list. + 2. For each element [represented by the collection](https://dom.spec.whatwg.org/#represented-by-the-collection), in [tree order](https://dom.spec.whatwg.org/#concept-tree-order): - + 1. If element has an [ID](https://dom.spec.whatwg.org/#concept-id) which is not in result, append element’s [ID](https://dom.spec.whatwg.org/#concept-id) to result. + 2. If element is in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and [has](https://dom.spec.whatwg.org/#concept-element-attribute-has) a [`name` attribute](https://dom.spec.whatwg.org/#concept-named-attribute) whose [value](https://dom.spec.whatwg.org/#concept-attribute-value) is neither the empty string nor is in result, append element’s [`name` attribute](https://dom.spec.whatwg.org/#concept-named-attribute) [value](https://dom.spec.whatwg.org/#concept-attribute-value) to result. - + 3. Return result. + -[HTMLCollection/namedItem](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection/namedItem '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.') +[HTMLCollection/namedItem](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection/namedItem "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.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE8+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `namedItem(key)`[](https://dom.spec.whatwg.org/#dom-htmlcollection-nameditem-key) method steps are: 1. If key is the empty string, return null. + 2. Return the first [element](https://dom.spec.whatwg.org/#concept-element) in the [collection](https://dom.spec.whatwg.org/#concept-collection) for which at least one of the following is true: - + - it has an [ID](https://dom.spec.whatwg.org/#concept-id) which is key; - it is in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and [has](https://dom.spec.whatwg.org/#concept-element-attribute-has) a [`name` attribute](https://dom.spec.whatwg.org/#concept-named-attribute) whose [value](https://dom.spec.whatwg.org/#concept-attribute-value) is key; - + or null if there is no such [element](https://dom.spec.whatwg.org/#concept-element). + ### 4.3. Mutation observers[](https://dom.spec.whatwg.org/#mutation-observers) @@ -3482,25 +3786,36 @@ Each [similar-origin window agent](https://html.spec.whatwg.org/multipage/webapp To queue a mutation observer microtask, run these steps: 1. If the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s [mutation observer microtask queued](https://dom.spec.whatwg.org/#mutation-observer-compound-microtask-queued-flag) is true, then return. + 2. Set the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s [mutation observer microtask queued](https://dom.spec.whatwg.org/#mutation-observer-compound-microtask-queued-flag) to true. + 3. [Queue](https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask) a [microtask](https://html.spec.whatwg.org/multipage/webappapis.html#microtask) to [notify mutation observers](https://dom.spec.whatwg.org/#notify-mutation-observers). + To notify mutation observers, run these steps: 1. Set the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s [mutation observer microtask queued](https://dom.spec.whatwg.org/#mutation-observer-compound-microtask-queued-flag) to false. + 2. Let notifySet be a [clone](https://infra.spec.whatwg.org/#list-clone) of the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s [mutation observers](https://dom.spec.whatwg.org/#mutation-observer-list). + 3. Let signalSet be a [clone](https://infra.spec.whatwg.org/#list-clone) of the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s [signal slots](https://dom.spec.whatwg.org/#signal-slot-list). + 4. [Empty](https://infra.spec.whatwg.org/#list-empty) the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s [signal slots](https://dom.spec.whatwg.org/#signal-slot-list). + 5. [For each](https://infra.spec.whatwg.org/#list-iterate) mo of notifySet: - + 1. Let records be a [clone](https://infra.spec.whatwg.org/#list-clone) of mo’s [record queue](https://dom.spec.whatwg.org/#concept-mo-queue). + 2. [Empty](https://infra.spec.whatwg.org/#list-empty) mo’s [record queue](https://dom.spec.whatwg.org/#concept-mo-queue). + 3. [For each](https://infra.spec.whatwg.org/#list-iterate) node of mo’s [node list](https://dom.spec.whatwg.org/#mutationobserver-node-list), [remove](https://infra.spec.whatwg.org/#list-remove) all [transient registered observers](https://dom.spec.whatwg.org/#transient-registered-observer) whose [observer](https://dom.spec.whatwg.org/#registered-observer-observer) is mo from node’s [registered observer list](https://dom.spec.whatwg.org/#registered-observer-list). + 4. If records [is not empty](https://infra.spec.whatwg.org/#list-is-empty), then [invoke](https://webidl.spec.whatwg.org/#invoke-a-callback-function) mo’s [callback](https://dom.spec.whatwg.org/#concept-mo-callback) with « records, mo », and mo. If this throws an exception, catch it, and [report the exception](https://html.spec.whatwg.org/multipage/webappapis.html#report-the-exception). - + 6. [For each](https://infra.spec.whatwg.org/#list-iterate) slot of signalSet, [fire an event](https://dom.spec.whatwg.org/#concept-event-fire) named `[slotchange](https://html.spec.whatwg.org/multipage/indices.html#event-slotchange)`, with its `[bubbles](https://dom.spec.whatwg.org/#dom-event-bubbles)` attribute set to true, at slot. + ---- +___ Each [node](https://dom.spec.whatwg.org/#concept-node) has a registered observer list (a [list](https://infra.spec.whatwg.org/#list) of zero or more [registered observers](https://dom.spec.whatwg.org/#registered-observer)), which is initially empty. @@ -3512,43 +3827,43 @@ A transient registered observer is a [registered observer](https://dom.spec.what #### 4.3.1. Interface `[MutationObserver](https://dom.spec.whatwg.org/#mutationobserver)`[](https://dom.spec.whatwg.org/#interface-mutationobserver) -[MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver 'The MutationObserver interface provides the ability to watch for changes being made to the DOM tree. It is designed as a replacement for the older Mutation Events feature, which was part of the DOM3 Events specification.') +[MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver "The MutationObserver interface provides the ability to watch for changes being made to the DOM tree. It is designed as a replacement for the older Mutation Events feature, which was part of the DOM3 Events specification.") In all current engines. Firefox14+Safari7+Chrome26+ ---- +___ Opera15+Edge79+ ---- +___ Edge (Legacy)12+IE11 ---- +___ Firefox for Android14+iOS Safari7+Chrome for Android26+Android WebView37+Samsung Internet1.5+Opera Mobile14+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `MutationObserver` { -[constructor](https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver)([MutationCallback](https://dom.spec.whatwg.org/#callbackdef-mutationcallback) `callback`[](https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver-callback-callback)); + [constructor](https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver)([MutationCallback](https://dom.spec.whatwg.org/#callbackdef-mutationcallback) `callback`[](https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver-callback-callback)); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [observe](https://dom.spec.whatwg.org/#dom-mutationobserver-observe)([Node](https://dom.spec.whatwg.org/#node) `target`[](https://dom.spec.whatwg.org/#dom-mutationobserver-observe-target-options-target), optional [MutationObserverInit](https://dom.spec.whatwg.org/#dictdef-mutationobserverinit) `options`[](https://dom.spec.whatwg.org/#dom-mutationobserver-observe-target-options-options) = {}); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [disconnect](https://dom.spec.whatwg.org/#dom-mutationobserver-disconnect)(); -[sequence](https://webidl.spec.whatwg.org/#idl-sequence)<[MutationRecord](https://dom.spec.whatwg.org/#mutationrecord)\> [takeRecords](https://dom.spec.whatwg.org/#dom-mutationobserver-takerecords)(); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [observe](https://dom.spec.whatwg.org/#dom-mutationobserver-observe)([Node](https://dom.spec.whatwg.org/#node) `target`[](https://dom.spec.whatwg.org/#dom-mutationobserver-observe-target-options-target), optional [MutationObserverInit](https://dom.spec.whatwg.org/#dictdef-mutationobserverinit) `options`[](https://dom.spec.whatwg.org/#dom-mutationobserver-observe-target-options-options) = {}); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [disconnect](https://dom.spec.whatwg.org/#dom-mutationobserver-disconnect)(); + [sequence](https://webidl.spec.whatwg.org/#idl-sequence)<[MutationRecord](https://dom.spec.whatwg.org/#mutationrecord)\> [takeRecords](https://dom.spec.whatwg.org/#dom-mutationobserver-takerecords)(); }; callback `MutationCallback` = [undefined](https://webidl.spec.whatwg.org/#idl-undefined) ([sequence](https://webidl.spec.whatwg.org/#idl-sequence)<[MutationRecord](https://dom.spec.whatwg.org/#mutationrecord)\> `mutations`[](https://dom.spec.whatwg.org/#dom-mutationcallback-mutations), [MutationObserver](https://dom.spec.whatwg.org/#mutationobserver) `observer`[](https://dom.spec.whatwg.org/#dom-mutationcallback-observer)); dictionary `MutationObserverInit` { -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `childList` = false; -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `attributes`; -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `characterData`; -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `subtree` = false; -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `attributeOldValue`; -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `characterDataOldValue`; -[sequence](https://webidl.spec.whatwg.org/#idl-sequence)<[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)\> `attributeFilter`; + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `childList` = false; + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `attributes`; + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `characterData`; + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `subtree` = false; + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `attributeOldValue`; + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `characterDataOldValue`; + [sequence](https://webidl.spec.whatwg.org/#idl-sequence)<[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)\> `attributeFilter`; }; A `[MutationObserver](https://dom.spec.whatwg.org/#mutationobserver)` object can be used to observe mutations to the [tree](https://dom.spec.whatwg.org/#concept-tree) of [nodes](https://dom.spec.whatwg.org/#concept-node). @@ -3559,47 +3874,47 @@ Each `[MutationObserver](https://dom.spec.whatwg.org/#mutationobserver)` object - A node list (a [list](https://infra.spec.whatwg.org/#list) of [nodes](https://dom.spec.whatwg.org/#concept-node)), which is initially empty. - A record queue (a [queue](https://infra.spec.whatwg.org/#queue) of zero or more `[MutationRecord](https://dom.spec.whatwg.org/#mutationrecord)` objects), which is initially empty. -[MutationObserver/MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/MutationObserver 'The DOM MutationObserver() constructor — part of the MutationObserver interface — creates and returns a new observer which invokes a specified callback when DOM events occur.') +[MutationObserver/MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/MutationObserver "The DOM MutationObserver() constructor — part of the MutationObserver interface — creates and returns a new observer which invokes a specified callback when DOM events occur.") In all current engines. Firefox14+Safari7+Chrome26+ ---- +___ Opera15+Edge79+ ---- +___ Edge (Legacy)12+IE11 ---- +___ Firefox for Android14+iOS Safari7+Chrome for Android26+Android WebView37+Samsung Internet1.5+Opera Mobile14+ -`` observer = new `[MutationObserver(callback)](https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver)` `` +``observer = new `[MutationObserver(callback)](https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver)` `` Constructs a `[MutationObserver](https://dom.spec.whatwg.org/#mutationobserver)` object and sets its [callback](https://dom.spec.whatwg.org/#concept-mo-callback) to callback. The callback is invoked with a list of `[MutationRecord](https://dom.spec.whatwg.org/#mutationrecord)` objects as first argument and the constructed `[MutationObserver](https://dom.spec.whatwg.org/#mutationobserver)` object as second argument. It is invoked after [nodes](https://dom.spec.whatwg.org/#concept-node) registered with the `[observe()](https://dom.spec.whatwg.org/#dom-mutationobserver-observe)` method, are mutated. -[MutationObserver/observe](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe 'The MutationObserver method observe() configures the MutationObserver callback to begin receiving notifications of changes to the DOM that match the given options.') +[MutationObserver/observe](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe "The MutationObserver method observe() configures the MutationObserver callback to begin receiving notifications of changes to the DOM that match the given options.") In all current engines. Firefox14+Safari6+Chrome18+ ---- +___ Opera15+Edge79+ ---- +___ Edge (Legacy)12+IE11 ---- +___ Firefox for Android14+iOS Safari6+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile14+ -`` observer . `[observe(target, options)](https://dom.spec.whatwg.org/#dom-mutationobserver-observe)` `` +``observer . `[observe(target, options)](https://dom.spec.whatwg.org/#dom-mutationobserver-observe)` `` Instructs the user agent to observe a given target (a [node](https://dom.spec.whatwg.org/#concept-node)) and report any mutations based on the criteria given by options (an object). @@ -3633,25 +3948,25 @@ Set to true if `[characterData](https://dom.spec.whatwg.org/#dom-mutationobserve Set to a list of [attribute](https://dom.spec.whatwg.org/#concept-attribute) [local names](https://dom.spec.whatwg.org/#concept-attribute-local-name) (without [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace)) if not all [attribute](https://dom.spec.whatwg.org/#concept-attribute) mutations need to be observed and `[attributes](https://dom.spec.whatwg.org/#dom-mutationobserverinit-attributes)` is true or omitted. -[MutationObserver/disconnect](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/disconnect 'The MutationObserver method disconnect() tells the observer to stop watching for mutations.') +[MutationObserver/disconnect](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/disconnect "The MutationObserver method disconnect() tells the observer to stop watching for mutations.") In all current engines. Firefox14+Safari6+Chrome18+ ---- +___ Opera15+Edge79+ ---- +___ Edge (Legacy)12+IE11 ---- +___ Firefox for Android14+iOS Safari6+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile14+ -`` observer . `[disconnect()](https://dom.spec.whatwg.org/#dom-mutationobserver-disconnect)` `` +``observer . `[disconnect()](https://dom.spec.whatwg.org/#dom-mutationobserver-disconnect)` `` Stops observer from observing any mutations. Until the `[observe()](https://dom.spec.whatwg.org/#dom-mutationobserver-observe)` method is used again, observer’s [callback](https://dom.spec.whatwg.org/#concept-mo-callback) will not be invoked. @@ -3661,90 +3976,115 @@ In all current engines. Firefox14+Safari6+Chrome18+ ---- +___ Opera15+Edge79+ ---- +___ Edge (Legacy)12+IE11 ---- +___ Firefox for Android14+iOS Safari6+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile14+ -`` observer . `[takeRecords()](https://dom.spec.whatwg.org/#dom-mutationobserver-takerecords)` `` +``observer . `[takeRecords()](https://dom.spec.whatwg.org/#dom-mutationobserver-takerecords)` `` Empties the [record queue](https://dom.spec.whatwg.org/#concept-mo-queue) and returns what was in there. The `new MutationObserver(callback)` constructor steps are: 1. Set [this](https://webidl.spec.whatwg.org/#this)’s [callback](https://dom.spec.whatwg.org/#concept-mo-callback) to callback. + 2. [Append](https://infra.spec.whatwg.org/#set-append) [this](https://webidl.spec.whatwg.org/#this) to [this](https://webidl.spec.whatwg.org/#this)’s [relevant agent](https://html.spec.whatwg.org/multipage/webappapis.html#relevant-agent)’s [mutation observers](https://dom.spec.whatwg.org/#mutation-observer-list). + The `observe(target, options)` method steps are: 1. If either options\["`[attributeOldValue](https://dom.spec.whatwg.org/#dom-mutationobserverinit-attributeoldvalue)`"\] or options\["`[attributeFilter](https://dom.spec.whatwg.org/#dom-mutationobserverinit-attributefilter)`"\] [exists](https://infra.spec.whatwg.org/#map-exists), and options\["`[attributes](https://dom.spec.whatwg.org/#dom-mutationobserverinit-attributes)`"\] does not [exist](https://infra.spec.whatwg.org/#map-exists), then set options\["`[attributes](https://dom.spec.whatwg.org/#dom-mutationobserverinit-attributes)`"\] to true. + 2. If options\["`[characterDataOldValue](https://dom.spec.whatwg.org/#dom-mutationobserverinit-characterdataoldvalue)`"\] [exists](https://infra.spec.whatwg.org/#map-exists) and options\["`[characterData](https://dom.spec.whatwg.org/#dom-mutationobserverinit-characterdata)`"\] does not [exist](https://infra.spec.whatwg.org/#map-exists), then set options\["`[characterData](https://dom.spec.whatwg.org/#dom-mutationobserverinit-characterdata)`"\] to true. + 3. If none of options\["`[childList](https://dom.spec.whatwg.org/#dom-mutationobserverinit-childlist)`"\], options\["`[attributes](https://dom.spec.whatwg.org/#dom-mutationobserverinit-attributes)`"\], and options\["`[characterData](https://dom.spec.whatwg.org/#dom-mutationobserverinit-characterdata)`"\] is true, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a `TypeError`. + 4. If options\["`[attributeOldValue](https://dom.spec.whatwg.org/#dom-mutationobserverinit-attributeoldvalue)`"\] is true and options\["`[attributes](https://dom.spec.whatwg.org/#dom-mutationobserverinit-attributes)`"\] is false, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a `TypeError`. + 5. If options\["`[attributeFilter](https://dom.spec.whatwg.org/#dom-mutationobserverinit-attributefilter)`"\] is present and options\["`[attributes](https://dom.spec.whatwg.org/#dom-mutationobserverinit-attributes)`"\] is false, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a `TypeError`. + 6. If options\["`[characterDataOldValue](https://dom.spec.whatwg.org/#dom-mutationobserverinit-characterdataoldvalue)`"\] is true and options\["`[characterData](https://dom.spec.whatwg.org/#dom-mutationobserverinit-characterdata)`"\] is false, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a `TypeError`. + 7. [For each](https://infra.spec.whatwg.org/#list-iterate) registered of target’s [registered observer list](https://dom.spec.whatwg.org/#registered-observer-list), if registered’s [observer](https://dom.spec.whatwg.org/#registered-observer-observer) is [this](https://webidl.spec.whatwg.org/#this): - + 1. [For each](https://infra.spec.whatwg.org/#list-iterate) node of [this](https://webidl.spec.whatwg.org/#this)’s [node list](https://dom.spec.whatwg.org/#mutationobserver-node-list), [remove](https://infra.spec.whatwg.org/#list-remove) all [transient registered observers](https://dom.spec.whatwg.org/#transient-registered-observer) whose [source](https://dom.spec.whatwg.org/#transient-registered-observer-source) is registered from node’s [registered observer list](https://dom.spec.whatwg.org/#registered-observer-list). + 2. Set registered’s [options](https://dom.spec.whatwg.org/#registered-observer-options) to options. - + 8. Otherwise: - + 1. [Append](https://infra.spec.whatwg.org/#list-append) a new [registered observer](https://dom.spec.whatwg.org/#registered-observer) whose [observer](https://dom.spec.whatwg.org/#registered-observer-observer) is [this](https://webidl.spec.whatwg.org/#this) and [options](https://dom.spec.whatwg.org/#registered-observer-options) is options to target’s [registered observer list](https://dom.spec.whatwg.org/#registered-observer-list). + 2. [Append](https://infra.spec.whatwg.org/#list-append) target to [this](https://webidl.spec.whatwg.org/#this)’s [node list](https://dom.spec.whatwg.org/#mutationobserver-node-list). + The `disconnect()` method steps are: 1. [For each](https://infra.spec.whatwg.org/#list-iterate) node of [this](https://webidl.spec.whatwg.org/#this)’s [node list](https://dom.spec.whatwg.org/#mutationobserver-node-list), [remove](https://infra.spec.whatwg.org/#list-remove) any [registered observer](https://dom.spec.whatwg.org/#registered-observer) from node’s [registered observer list](https://dom.spec.whatwg.org/#registered-observer-list) for which [this](https://webidl.spec.whatwg.org/#this) is the [observer](https://dom.spec.whatwg.org/#registered-observer-observer). + 2. [Empty](https://infra.spec.whatwg.org/#list-empty) [this](https://webidl.spec.whatwg.org/#this)’s [record queue](https://dom.spec.whatwg.org/#concept-mo-queue). + The `takeRecords()` method steps are: 1. Let records be a [clone](https://infra.spec.whatwg.org/#list-clone) of [this](https://webidl.spec.whatwg.org/#this)’s [record queue](https://dom.spec.whatwg.org/#concept-mo-queue). + 2. [Empty](https://infra.spec.whatwg.org/#list-empty) [this](https://webidl.spec.whatwg.org/#this)’s [record queue](https://dom.spec.whatwg.org/#concept-mo-queue). + 3. Return records. + #### 4.3.2. Queuing a mutation record[](https://dom.spec.whatwg.org/#queueing-a-mutation-record) To queue a mutation record of type for target with name, namespace, oldValue, addedNodes, removedNodes, previousSibling, and nextSibling, run these steps: 1. Let interestedObservers be an empty [map](https://infra.spec.whatwg.org/#ordered-map). + 2. Let nodes be the [inclusive ancestors](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of target. + 3. For each node in nodes, and then [for each](https://infra.spec.whatwg.org/#list-iterate) registered of node’s [registered observer list](https://dom.spec.whatwg.org/#registered-observer-list): - + 1. Let options be registered’s [options](https://dom.spec.whatwg.org/#registered-observer-options). + 2. If none of the following are true - + - node is not target and options\["`[subtree](https://dom.spec.whatwg.org/#dom-mutationobserverinit-subtree)`"\] is false - type is "`attributes`" and options\["`[attributes](https://dom.spec.whatwg.org/#dom-mutationobserverinit-attributes)`"\] either does not [exist](https://infra.spec.whatwg.org/#map-exists) or is false - type is "`attributes`", options\["`[attributeFilter](https://dom.spec.whatwg.org/#dom-mutationobserverinit-attributefilter)`"\] [exists](https://infra.spec.whatwg.org/#map-exists), and options\["`[attributeFilter](https://dom.spec.whatwg.org/#dom-mutationobserverinit-attributefilter)`"\] does not [contain](https://infra.spec.whatwg.org/#list-contain) name or namespace is non-null - type is "`characterData`" and options\["`[characterData](https://dom.spec.whatwg.org/#dom-mutationobserverinit-characterdata)`"\] either does not [exist](https://infra.spec.whatwg.org/#map-exists) or is false - type is "`childList`" and options\["`[childList](https://dom.spec.whatwg.org/#dom-mutationobserverinit-childlist)`"\] is false - + then: - + 1. Let mo be registered’s [observer](https://dom.spec.whatwg.org/#registered-observer-observer). + 2. If interestedObservers\[mo\] does not [exist](https://infra.spec.whatwg.org/#map-exists), then [set](https://infra.spec.whatwg.org/#map-set) interestedObservers\[mo\] to null. + 3. If either type is "`attributes`" and options\["`[attributeOldValue](https://dom.spec.whatwg.org/#dom-mutationobserverinit-attributeoldvalue)`"\] is true, or type is "`characterData`" and options\["`[characterDataOldValue](https://dom.spec.whatwg.org/#dom-mutationobserverinit-characterdataoldvalue)`"\] is true, then [set](https://infra.spec.whatwg.org/#map-set) interestedObservers\[mo\] to oldValue. - + 4. [For each](https://infra.spec.whatwg.org/#map-iterate) observer → mappedOldValue of interestedObservers: - + 1. Let record be a new `[MutationRecord](https://dom.spec.whatwg.org/#mutationrecord)` object with its `[type](https://dom.spec.whatwg.org/#dom-mutationrecord-type)` set to type, `[target](https://dom.spec.whatwg.org/#dom-mutationrecord-target)` set to target, `[attributeName](https://dom.spec.whatwg.org/#dom-mutationrecord-attributename)` set to name, `[attributeNamespace](https://dom.spec.whatwg.org/#dom-mutationrecord-attributenamespace)` set to namespace, `[oldValue](https://dom.spec.whatwg.org/#dom-mutationrecord-oldvalue)` set to mappedOldValue, `[addedNodes](https://dom.spec.whatwg.org/#dom-mutationrecord-addednodes)` set to addedNodes, `[removedNodes](https://dom.spec.whatwg.org/#dom-mutationrecord-removednodes)` set to removedNodes, `[previousSibling](https://dom.spec.whatwg.org/#dom-mutationrecord-previoussibling)` set to previousSibling, and `[nextSibling](https://dom.spec.whatwg.org/#dom-mutationrecord-nextsibling)` set to nextSibling. + 2. [Enqueue](https://infra.spec.whatwg.org/#queue-enqueue) record to observer’s [record queue](https://dom.spec.whatwg.org/#concept-mo-queue). - + 5. [Queue a mutation observer microtask](https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask). + To queue a tree mutation record for target with addedNodes, removedNodes, previousSibling, and nextSibling, run these steps: 1. Assert: either addedNodes or removedNodes [is not empty](https://infra.spec.whatwg.org/#list-is-empty). + 2. [Queue a mutation record](https://dom.spec.whatwg.org/#queue-a-mutation-record) of "`childList`" for target with null, null, null, addedNodes, removedNodes, previousSibling, and nextSibling. + #### 4.3.3. Interface `[MutationRecord](https://dom.spec.whatwg.org/#mutationrecord)`[](https://dom.spec.whatwg.org/#interface-mutationrecord) @@ -3754,60 +4094,60 @@ In all current engines. Firefox14+Safari7+Chrome16+ ---- +___ Opera15+Edge79+ ---- +___ Edge (Legacy)12+IE11 ---- +___ Firefox for Android14+iOS Safari7+Chrome for Android25+Android WebView37+Samsung Internet1.5+Opera Mobile14+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `MutationRecord` { -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [type](https://dom.spec.whatwg.org/#dom-mutationrecord-type); -\[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [Node](https://dom.spec.whatwg.org/#node) [target](https://dom.spec.whatwg.org/#dom-mutationrecord-target); -\[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [NodeList](https://dom.spec.whatwg.org/#nodelist) [addedNodes](https://dom.spec.whatwg.org/#dom-mutationrecord-addednodes); -\[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [NodeList](https://dom.spec.whatwg.org/#nodelist) [removedNodes](https://dom.spec.whatwg.org/#dom-mutationrecord-removednodes); -readonly attribute [Node](https://dom.spec.whatwg.org/#node)? [previousSibling](https://dom.spec.whatwg.org/#dom-mutationrecord-previoussibling); -readonly attribute [Node](https://dom.spec.whatwg.org/#node)? [nextSibling](https://dom.spec.whatwg.org/#dom-mutationrecord-nextsibling); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [attributeName](https://dom.spec.whatwg.org/#dom-mutationrecord-attributename); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [attributeNamespace](https://dom.spec.whatwg.org/#dom-mutationrecord-attributenamespace); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [oldValue](https://dom.spec.whatwg.org/#dom-mutationrecord-oldvalue); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [type](https://dom.spec.whatwg.org/#dom-mutationrecord-type); + \[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [Node](https://dom.spec.whatwg.org/#node) [target](https://dom.spec.whatwg.org/#dom-mutationrecord-target); + \[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [NodeList](https://dom.spec.whatwg.org/#nodelist) [addedNodes](https://dom.spec.whatwg.org/#dom-mutationrecord-addednodes); + \[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [NodeList](https://dom.spec.whatwg.org/#nodelist) [removedNodes](https://dom.spec.whatwg.org/#dom-mutationrecord-removednodes); + readonly attribute [Node](https://dom.spec.whatwg.org/#node)? [previousSibling](https://dom.spec.whatwg.org/#dom-mutationrecord-previoussibling); + readonly attribute [Node](https://dom.spec.whatwg.org/#node)? [nextSibling](https://dom.spec.whatwg.org/#dom-mutationrecord-nextsibling); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [attributeName](https://dom.spec.whatwg.org/#dom-mutationrecord-attributename); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [attributeNamespace](https://dom.spec.whatwg.org/#dom-mutationrecord-attributenamespace); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [oldValue](https://dom.spec.whatwg.org/#dom-mutationrecord-oldvalue); }; -`` record . `[type](https://dom.spec.whatwg.org/#dom-mutationrecord-type)` `` +``record . `[type](https://dom.spec.whatwg.org/#dom-mutationrecord-type)` `` Returns "`attributes`" if it was an [attribute](https://dom.spec.whatwg.org/#concept-attribute) mutation. "`characterData`" if it was a mutation to a `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node). And "`childList`" if it was a mutation to the [tree](https://dom.spec.whatwg.org/#concept-tree) of [nodes](https://dom.spec.whatwg.org/#concept-node). -`` record . `[target](https://dom.spec.whatwg.org/#dom-mutationrecord-target)` `` +``record . `[target](https://dom.spec.whatwg.org/#dom-mutationrecord-target)` `` Returns the [node](https://dom.spec.whatwg.org/#concept-node) the mutation affected, depending on the `[type](https://dom.spec.whatwg.org/#dom-mutationrecord-type)`. For "`attributes`", it is the [element](https://dom.spec.whatwg.org/#concept-element) whose [attribute](https://dom.spec.whatwg.org/#concept-attribute) changed. For "`characterData`", it is the `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node). For "`childList`", it is the [node](https://dom.spec.whatwg.org/#concept-node) whose [children](https://dom.spec.whatwg.org/#concept-tree-child) changed. -`` record . `[addedNodes](https://dom.spec.whatwg.org/#dom-mutationrecord-addednodes)` `` +``record . `[addedNodes](https://dom.spec.whatwg.org/#dom-mutationrecord-addednodes)` `` -`` record . `[removedNodes](https://dom.spec.whatwg.org/#dom-mutationrecord-removednodes)` `` +``record . `[removedNodes](https://dom.spec.whatwg.org/#dom-mutationrecord-removednodes)` `` Return the [nodes](https://dom.spec.whatwg.org/#concept-node) added and removed respectively. -`` record . `[previousSibling](https://dom.spec.whatwg.org/#dom-mutationrecord-previoussibling)` `` +``record . `[previousSibling](https://dom.spec.whatwg.org/#dom-mutationrecord-previoussibling)` `` -`` record . `[nextSibling](https://dom.spec.whatwg.org/#dom-mutationrecord-nextsibling)` `` +``record . `[nextSibling](https://dom.spec.whatwg.org/#dom-mutationrecord-nextsibling)` `` Return the [previous](https://dom.spec.whatwg.org/#concept-tree-previous-sibling) and [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling) respectively of the added or removed [nodes](https://dom.spec.whatwg.org/#concept-node); otherwise null. -`` record . `[attributeName](https://dom.spec.whatwg.org/#dom-mutationrecord-attributename)` `` +``record . `[attributeName](https://dom.spec.whatwg.org/#dom-mutationrecord-attributename)` `` Returns the [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) of the changed [attribute](https://dom.spec.whatwg.org/#concept-attribute); otherwise null. -`` record . `[attributeNamespace](https://dom.spec.whatwg.org/#dom-mutationrecord-attributenamespace)` `` +``record . `[attributeNamespace](https://dom.spec.whatwg.org/#dom-mutationrecord-attributenamespace)` `` Returns the [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace) of the changed [attribute](https://dom.spec.whatwg.org/#concept-attribute); otherwise null. -`` record . `[oldValue](https://dom.spec.whatwg.org/#dom-mutationrecord-oldvalue)` `` +``record . `[oldValue](https://dom.spec.whatwg.org/#dom-mutationrecord-oldvalue)` `` The return value depends on `[type](https://dom.spec.whatwg.org/#dom-mutationrecord-type)`. For "`attributes`", it is the [value](https://dom.spec.whatwg.org/#concept-attribute-value) of the changed [attribute](https://dom.spec.whatwg.org/#concept-attribute) before the change. For "`characterData`", it is the [data](https://dom.spec.whatwg.org/#concept-cd-data) of the changed [node](https://dom.spec.whatwg.org/#concept-node) before the change. For "`childList`", it is null. @@ -3821,84 +4161,84 @@ The `type`, `target`, `addedNodes`, `removedNodes`, `previousSibling`, `nextSibl ### 4.4. Interface `[Node](https://dom.spec.whatwg.org/#node)`[](https://dom.spec.whatwg.org/#interface-node) -[Node](https://developer.mozilla.org/en-US/docs/Web/API/Node 'The DOM Node interface is an abstract base class upon which many other DOM API objects are based, thus letting those object types to 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, Element, and DocumentFragment.') +[Node](https://developer.mozilla.org/en-US/docs/Web/API/Node "The DOM Node interface is an abstract base class upon which many other DOM API objects are based, thus letting those object types to 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, Element, and DocumentFragment.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `Node` : [EventTarget](https://dom.spec.whatwg.org/#eventtarget) { -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [ELEMENT_NODE](https://dom.spec.whatwg.org/#dom-node-element_node) = 1; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [ATTRIBUTE_NODE](https://dom.spec.whatwg.org/#dom-node-attribute_node) = 2; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [TEXT_NODE](https://dom.spec.whatwg.org/#dom-node-text_node) = 3; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [CDATA_SECTION_NODE](https://dom.spec.whatwg.org/#dom-node-cdata_section_node) = 4; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ENTITY_REFERENCE_NODE`[](https://dom.spec.whatwg.org/#dom-node-entity_reference_node) = 5; // legacy -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ENTITY_NODE`[](https://dom.spec.whatwg.org/#dom-node-entity_node) = 6; // legacy -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [PROCESSING_INSTRUCTION_NODE](https://dom.spec.whatwg.org/#dom-node-processing_instruction_node) = 7; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [COMMENT_NODE](https://dom.spec.whatwg.org/#dom-node-comment_node) = 8; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT_NODE](https://dom.spec.whatwg.org/#dom-node-document_node) = 9; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT_TYPE_NODE](https://dom.spec.whatwg.org/#dom-node-document_type_node) = 10; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT_FRAGMENT_NODE](https://dom.spec.whatwg.org/#dom-node-document_fragment_node) = 11; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `NOTATION_NODE`[](https://dom.spec.whatwg.org/#dom-node-notation_node) = 12; // legacy -readonly attribute [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [nodeType](https://dom.spec.whatwg.org/#dom-node-nodetype); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [nodeName](https://dom.spec.whatwg.org/#dom-node-nodename); - -readonly attribute [USVString](https://webidl.spec.whatwg.org/#idl-USVString) [baseURI](https://dom.spec.whatwg.org/#dom-node-baseuri); - -readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [isConnected](https://dom.spec.whatwg.org/#dom-node-isconnected); -readonly attribute [Document](https://dom.spec.whatwg.org/#document)? [ownerDocument](https://dom.spec.whatwg.org/#dom-node-ownerdocument); -[Node](https://dom.spec.whatwg.org/#node) [getRootNode](https://dom.spec.whatwg.org/#dom-node-getrootnode)(optional [GetRootNodeOptions](https://dom.spec.whatwg.org/#dictdef-getrootnodeoptions) `options`[](https://dom.spec.whatwg.org/#dom-node-getrootnode-options-options) = {}); -readonly attribute [Node](https://dom.spec.whatwg.org/#node)? [parentNode](https://dom.spec.whatwg.org/#dom-node-parentnode); -readonly attribute [Element](https://dom.spec.whatwg.org/#element)? [parentElement](https://dom.spec.whatwg.org/#dom-node-parentelement); -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [hasChildNodes](https://dom.spec.whatwg.org/#dom-node-haschildnodes)(); -\[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [NodeList](https://dom.spec.whatwg.org/#nodelist) [childNodes](https://dom.spec.whatwg.org/#dom-node-childnodes); -readonly attribute [Node](https://dom.spec.whatwg.org/#node)? [firstChild](https://dom.spec.whatwg.org/#dom-node-firstchild); -readonly attribute [Node](https://dom.spec.whatwg.org/#node)? [lastChild](https://dom.spec.whatwg.org/#dom-node-lastchild); -readonly attribute [Node](https://dom.spec.whatwg.org/#node)? [previousSibling](https://dom.spec.whatwg.org/#dom-node-previoussibling); -readonly attribute [Node](https://dom.spec.whatwg.org/#node)? [nextSibling](https://dom.spec.whatwg.org/#dom-node-nextsibling); - -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [nodeValue](https://dom.spec.whatwg.org/#dom-node-nodevalue); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [textContent](https://dom.spec.whatwg.org/#dom-node-textcontent); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [normalize](https://dom.spec.whatwg.org/#dom-node-normalize)(); - -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Node](https://dom.spec.whatwg.org/#node) [cloneNode](https://dom.spec.whatwg.org/#dom-node-clonenode)(optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `deep`[](https://dom.spec.whatwg.org/#dom-node-clonenode-deep-deep) = false); -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [isEqualNode](https://dom.spec.whatwg.org/#dom-node-isequalnode)([Node](https://dom.spec.whatwg.org/#node)? `otherNode`[](https://dom.spec.whatwg.org/#dom-node-isequalnode-othernode-othernode)); -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [isSameNode](https://dom.spec.whatwg.org/#dom-node-issamenode)([Node](https://dom.spec.whatwg.org/#node)? `otherNode`[](https://dom.spec.whatwg.org/#dom-node-issamenode-othernode-othernode)); // legacy alias of === - -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT_POSITION_DISCONNECTED](https://dom.spec.whatwg.org/#dom-node-document_position_disconnected) = 0x01; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT_POSITION_PRECEDING](https://dom.spec.whatwg.org/#dom-node-document_position_preceding) = 0x02; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT_POSITION_FOLLOWING](https://dom.spec.whatwg.org/#dom-node-document_position_following) = 0x04; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT_POSITION_CONTAINS](https://dom.spec.whatwg.org/#dom-node-document_position_contains) = 0x08; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT_POSITION_CONTAINED_BY](https://dom.spec.whatwg.org/#dom-node-document_position_contained_by) = 0x10; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC](https://dom.spec.whatwg.org/#dom-node-document_position_implementation_specific) = 0x20; -[unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [compareDocumentPosition](https://dom.spec.whatwg.org/#dom-node-comparedocumentposition)([Node](https://dom.spec.whatwg.org/#node) `other`[](https://dom.spec.whatwg.org/#dom-node-comparedocumentposition-other-other)); -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [contains](https://dom.spec.whatwg.org/#dom-node-contains)([Node](https://dom.spec.whatwg.org/#node)? `other`[](https://dom.spec.whatwg.org/#dom-node-contains-other-other)); - -[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [lookupPrefix](https://dom.spec.whatwg.org/#dom-node-lookupprefix)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-node-lookupprefix-namespace-namespace)); -[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [lookupNamespaceURI](https://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `prefix`[](https://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri-prefix-prefix)); -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [isDefaultNamespace](https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace-namespace-namespace)); - -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Node](https://dom.spec.whatwg.org/#node) [insertBefore](https://dom.spec.whatwg.org/#dom-node-insertbefore)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-node-insertbefore-node-child-node), [Node](https://dom.spec.whatwg.org/#node)? `child`[](https://dom.spec.whatwg.org/#dom-node-insertbefore-node-child-child)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Node](https://dom.spec.whatwg.org/#node) [appendChild](https://dom.spec.whatwg.org/#dom-node-appendchild)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-node-appendchild-node-node)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Node](https://dom.spec.whatwg.org/#node) [replaceChild](https://dom.spec.whatwg.org/#dom-node-replacechild)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-node-replacechild-node-child-node), [Node](https://dom.spec.whatwg.org/#node) `child`[](https://dom.spec.whatwg.org/#dom-node-replacechild-node-child-child)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Node](https://dom.spec.whatwg.org/#node) [removeChild](https://dom.spec.whatwg.org/#dom-node-removechild)([Node](https://dom.spec.whatwg.org/#node) `child`[](https://dom.spec.whatwg.org/#dom-node-removechild-child-child)); + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [ELEMENT\_NODE](https://dom.spec.whatwg.org/#dom-node-element_node) = 1; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [ATTRIBUTE\_NODE](https://dom.spec.whatwg.org/#dom-node-attribute_node) = 2; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [TEXT\_NODE](https://dom.spec.whatwg.org/#dom-node-text_node) = 3; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [CDATA\_SECTION\_NODE](https://dom.spec.whatwg.org/#dom-node-cdata_section_node) = 4; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ENTITY_REFERENCE_NODE`[](https://dom.spec.whatwg.org/#dom-node-entity_reference_node) = 5; // legacy + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ENTITY_NODE`[](https://dom.spec.whatwg.org/#dom-node-entity_node) = 6; // legacy + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [PROCESSING\_INSTRUCTION\_NODE](https://dom.spec.whatwg.org/#dom-node-processing_instruction_node) = 7; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [COMMENT\_NODE](https://dom.spec.whatwg.org/#dom-node-comment_node) = 8; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT\_NODE](https://dom.spec.whatwg.org/#dom-node-document_node) = 9; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT\_TYPE\_NODE](https://dom.spec.whatwg.org/#dom-node-document_type_node) = 10; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT\_FRAGMENT\_NODE](https://dom.spec.whatwg.org/#dom-node-document_fragment_node) = 11; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `NOTATION_NODE`[](https://dom.spec.whatwg.org/#dom-node-notation_node) = 12; // legacy + readonly attribute [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [nodeType](https://dom.spec.whatwg.org/#dom-node-nodetype); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [nodeName](https://dom.spec.whatwg.org/#dom-node-nodename); + + readonly attribute [USVString](https://webidl.spec.whatwg.org/#idl-USVString) [baseURI](https://dom.spec.whatwg.org/#dom-node-baseuri); + + readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [isConnected](https://dom.spec.whatwg.org/#dom-node-isconnected); + readonly attribute [Document](https://dom.spec.whatwg.org/#document)? [ownerDocument](https://dom.spec.whatwg.org/#dom-node-ownerdocument); + [Node](https://dom.spec.whatwg.org/#node) [getRootNode](https://dom.spec.whatwg.org/#dom-node-getrootnode)(optional [GetRootNodeOptions](https://dom.spec.whatwg.org/#dictdef-getrootnodeoptions) `options`[](https://dom.spec.whatwg.org/#dom-node-getrootnode-options-options) = {}); + readonly attribute [Node](https://dom.spec.whatwg.org/#node)? [parentNode](https://dom.spec.whatwg.org/#dom-node-parentnode); + readonly attribute [Element](https://dom.spec.whatwg.org/#element)? [parentElement](https://dom.spec.whatwg.org/#dom-node-parentelement); + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [hasChildNodes](https://dom.spec.whatwg.org/#dom-node-haschildnodes)(); + \[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [NodeList](https://dom.spec.whatwg.org/#nodelist) [childNodes](https://dom.spec.whatwg.org/#dom-node-childnodes); + readonly attribute [Node](https://dom.spec.whatwg.org/#node)? [firstChild](https://dom.spec.whatwg.org/#dom-node-firstchild); + readonly attribute [Node](https://dom.spec.whatwg.org/#node)? [lastChild](https://dom.spec.whatwg.org/#dom-node-lastchild); + readonly attribute [Node](https://dom.spec.whatwg.org/#node)? [previousSibling](https://dom.spec.whatwg.org/#dom-node-previoussibling); + readonly attribute [Node](https://dom.spec.whatwg.org/#node)? [nextSibling](https://dom.spec.whatwg.org/#dom-node-nextsibling); + + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [nodeValue](https://dom.spec.whatwg.org/#dom-node-nodevalue); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [textContent](https://dom.spec.whatwg.org/#dom-node-textcontent); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [normalize](https://dom.spec.whatwg.org/#dom-node-normalize)(); + + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Node](https://dom.spec.whatwg.org/#node) [cloneNode](https://dom.spec.whatwg.org/#dom-node-clonenode)(optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `deep`[](https://dom.spec.whatwg.org/#dom-node-clonenode-deep-deep) = false); + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [isEqualNode](https://dom.spec.whatwg.org/#dom-node-isequalnode)([Node](https://dom.spec.whatwg.org/#node)? `otherNode`[](https://dom.spec.whatwg.org/#dom-node-isequalnode-othernode-othernode)); + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [isSameNode](https://dom.spec.whatwg.org/#dom-node-issamenode)([Node](https://dom.spec.whatwg.org/#node)? `otherNode`[](https://dom.spec.whatwg.org/#dom-node-issamenode-othernode-othernode)); // legacy alias of === + + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT\_POSITION\_DISCONNECTED](https://dom.spec.whatwg.org/#dom-node-document_position_disconnected) = 0x01; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT\_POSITION\_PRECEDING](https://dom.spec.whatwg.org/#dom-node-document_position_preceding) = 0x02; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT\_POSITION\_FOLLOWING](https://dom.spec.whatwg.org/#dom-node-document_position_following) = 0x04; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT\_POSITION\_CONTAINS](https://dom.spec.whatwg.org/#dom-node-document_position_contains) = 0x08; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT\_POSITION\_CONTAINED\_BY](https://dom.spec.whatwg.org/#dom-node-document_position_contained_by) = 0x10; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [DOCUMENT\_POSITION\_IMPLEMENTATION\_SPECIFIC](https://dom.spec.whatwg.org/#dom-node-document_position_implementation_specific) = 0x20; + [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [compareDocumentPosition](https://dom.spec.whatwg.org/#dom-node-comparedocumentposition)([Node](https://dom.spec.whatwg.org/#node) `other`[](https://dom.spec.whatwg.org/#dom-node-comparedocumentposition-other-other)); + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [contains](https://dom.spec.whatwg.org/#dom-node-contains)([Node](https://dom.spec.whatwg.org/#node)? `other`[](https://dom.spec.whatwg.org/#dom-node-contains-other-other)); + + [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [lookupPrefix](https://dom.spec.whatwg.org/#dom-node-lookupprefix)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-node-lookupprefix-namespace-namespace)); + [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [lookupNamespaceURI](https://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `prefix`[](https://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri-prefix-prefix)); + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [isDefaultNamespace](https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace-namespace-namespace)); + + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Node](https://dom.spec.whatwg.org/#node) [insertBefore](https://dom.spec.whatwg.org/#dom-node-insertbefore)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-node-insertbefore-node-child-node), [Node](https://dom.spec.whatwg.org/#node)? `child`[](https://dom.spec.whatwg.org/#dom-node-insertbefore-node-child-child)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Node](https://dom.spec.whatwg.org/#node) [appendChild](https://dom.spec.whatwg.org/#dom-node-appendchild)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-node-appendchild-node-node)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Node](https://dom.spec.whatwg.org/#node) [replaceChild](https://dom.spec.whatwg.org/#dom-node-replacechild)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-node-replacechild-node-child-node), [Node](https://dom.spec.whatwg.org/#node) `child`[](https://dom.spec.whatwg.org/#dom-node-replacechild-node-child-child)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Node](https://dom.spec.whatwg.org/#node) [removeChild](https://dom.spec.whatwg.org/#dom-node-removechild)([Node](https://dom.spec.whatwg.org/#node) `child`[](https://dom.spec.whatwg.org/#dom-node-removechild-child-child)); }; dictionary `GetRootNodeOptions` { -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `composed` = false; + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `composed` = false; }; `[Node](https://dom.spec.whatwg.org/#node)` is an abstract interface that is used by all [nodes](https://dom.spec.whatwg.org/#concept-node). You cannot get a direct instance of it. @@ -3911,27 +4251,27 @@ A [node](https://dom.spec.whatwg.org/#concept-node)’s [get the parent](https:/ Each [node](https://dom.spec.whatwg.org/#concept-node) also has a [registered observer list](https://dom.spec.whatwg.org/#registered-observer-list). ---- +___ -[Node/nodeType](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType 'The read-only nodeType property of a Node element is an integer that identifies what the node is. It distinguishes different kind of nodes from each other, such as elements, text and comments.') +[Node/nodeType](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType "The read-only nodeType property of a Node element is an integer that identifies what the node is. It distinguishes different kind of nodes from each other, such as elements, text and comments.") In all current engines. Firefox1+Safari1.1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ -`` node . `[nodeType](https://dom.spec.whatwg.org/#dom-node-nodetype)` `` +``node . `[nodeType](https://dom.spec.whatwg.org/#dom-node-nodetype)` `` Returns a number appropriate for the type of node, as follows: @@ -3971,25 +4311,25 @@ An [exclusive `Text` node](https://dom.spec.whatwg.org/#exclusive-text-node) `` `[Node](https://dom.spec.whatwg.org/#node)` . `[DOCUMENT_FRAGMENT_NODE](https://dom.spec.whatwg.org/#dom-node-document_fragment_node)` `` (11). -[Node/nodeName](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName 'The read-only nodeName property of Node returns the name of the current node as a string.') +[Node/nodeName](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName "The read-only nodeName property of Node returns the name of the current node as a string.") In all current engines. Firefox1+Safari7+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari7+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` node . `[nodeName](https://dom.spec.whatwg.org/#dom-node-nodename)` `` +``node . `[nodeName](https://dom.spec.whatwg.org/#dom-node-nodename)` `` Returns a string appropriate for the type of node, as follows: @@ -4105,75 +4445,75 @@ Its [name](https://dom.spec.whatwg.org/#concept-doctype-name). "`#document-fragment`". ---- +___ -[Node/baseURI](https://developer.mozilla.org/en-US/docs/Web/API/Node/baseURI 'The read-only baseURI property of the Node interface returns the absolute base URL of the document containing the node.') +[Node/baseURI](https://developer.mozilla.org/en-US/docs/Web/API/Node/baseURI "The read-only baseURI property of the Node interface returns the absolute base URL of the document containing the node.") In all current engines. Firefox1+Safari7+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari7+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` node . `[baseURI](https://dom.spec.whatwg.org/#dom-node-baseuri)` `` +``node . `[baseURI](https://dom.spec.whatwg.org/#dom-node-baseuri)` `` Returns node’s [node document](https://dom.spec.whatwg.org/#concept-node-document)’s [document base URL](https://html.spec.whatwg.org/multipage/urls-and-fetching.html#document-base-url). The `baseURI` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [node document](https://dom.spec.whatwg.org/#concept-node-document)’s [document base URL](https://html.spec.whatwg.org/multipage/urls-and-fetching.html#document-base-url), [serialized](https://url.spec.whatwg.org/#concept-url-serializer). ---- +___ -[Node/isConnected](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected 'The read-only isConnected property of the Node interface returns a boolean indicating whether the node is connected (directly or indirectly) to the context object, for example the Document object in the case of the normal DOM, or the ShadowRoot in the case of a shadow DOM.') +[Node/isConnected](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected "The read-only isConnected property of the Node interface returns a boolean indicating whether the node is connected (directly or indirectly) to the context object, for example the Document object in the case of the normal DOM, or the ShadowRoot in the case of a shadow DOM.") In all current engines. Firefox49+Safari10+Chrome51+ ---- +___ Opera38+Edge79+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android49+iOS Safari10+Chrome for Android51+Android WebView51+Samsung Internet6.0+Opera Mobile41+ -`` node . `[isConnected](https://dom.spec.whatwg.org/#dom-node-isconnected)` `` +``node . `[isConnected](https://dom.spec.whatwg.org/#dom-node-isconnected)` `` Returns true if node is [connected](https://dom.spec.whatwg.org/#connected); otherwise false. -[Node/ownerDocument](https://developer.mozilla.org/en-US/docs/Web/API/Node/ownerDocument 'The read-only ownerDocument property of the Node interface returns the top-level document object of the node.') +[Node/ownerDocument](https://developer.mozilla.org/en-US/docs/Web/API/Node/ownerDocument "The read-only ownerDocument property of the Node interface returns the top-level document object of the node.") In all current engines. Firefox9+Safari7+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android9+iOS Safari7+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` node . `[ownerDocument](https://dom.spec.whatwg.org/#dom-node-ownerdocument)` `` +``node . `[ownerDocument](https://dom.spec.whatwg.org/#dom-node-ownerdocument)` `` Returns the [node document](https://dom.spec.whatwg.org/#concept-node-document). Returns null for [documents](https://dom.spec.whatwg.org/#concept-document). @@ -4183,19 +4523,19 @@ In all current engines. Firefox53+Safari10.1+Chrome54+ ---- +___ Opera41+Edge79+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android53+iOS Safari10.3+Chrome for Android54+Android WebView54+Samsung Internet6.0+Opera Mobile41+ -`` node . `[getRootNode()](https://dom.spec.whatwg.org/#dom-node-getrootnode)` `` +``node . `[getRootNode()](https://dom.spec.whatwg.org/#dom-node-getrootnode)` `` Returns node’s [root](https://dom.spec.whatwg.org/#concept-tree-root). @@ -4203,25 +4543,25 @@ Returns node’s [root](https://dom.spec.whatwg.org/#concept-tree-root). Returns node’s [shadow-including root](https://dom.spec.whatwg.org/#concept-shadow-including-root). -[Node/parentNode](https://developer.mozilla.org/en-US/docs/Web/API/Node/parentNode 'The read-only parentNode property of the Node interface returns the parent of the specified node in the DOM tree.') +[Node/parentNode](https://developer.mozilla.org/en-US/docs/Web/API/Node/parentNode "The read-only parentNode property of the Node interface returns the parent of the specified node in the DOM tree.") In all current engines. Firefox1+Safari1.1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE5.5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ -`` node . `[parentNode](https://dom.spec.whatwg.org/#dom-node-parentnode)` `` +``node . `[parentNode](https://dom.spec.whatwg.org/#dom-node-parentnode)` `` Returns the [parent](https://dom.spec.whatwg.org/#concept-tree-parent). @@ -4231,63 +4571,63 @@ In all current engines. Firefox9+Safari1.1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android9+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ -`` node . `[parentElement](https://dom.spec.whatwg.org/#dom-node-parentelement)` `` +``node . `[parentElement](https://dom.spec.whatwg.org/#dom-node-parentelement)` `` Returns the [parent element](https://dom.spec.whatwg.org/#parent-element). -[Node/hasChildNodes](https://developer.mozilla.org/en-US/docs/Web/API/Node/hasChildNodes 'The hasChildNodes() method of the Node interface returns a boolean value indicating whether the given Node has child nodes or not.') +[Node/hasChildNodes](https://developer.mozilla.org/en-US/docs/Web/API/Node/hasChildNodes "The hasChildNodes() method of the Node interface returns a boolean value indicating whether the given Node has child nodes or not.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` node . `[hasChildNodes()](https://dom.spec.whatwg.org/#dom-node-haschildnodes)` `` +``node . `[hasChildNodes()](https://dom.spec.whatwg.org/#dom-node-haschildnodes)` `` Returns whether node has [children](https://dom.spec.whatwg.org/#concept-tree-child). -[Node/childNodes](https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes 'The read-only childNodes property of the Node interface returns a live NodeList of child nodes of the given element where the first child node is assigned index 0. Child nodes include elements, text and comments.') +[Node/childNodes](https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes "The read-only childNodes property of the Node interface returns a live NodeList of child nodes of the given element where the first child node is assigned index 0. Child nodes include elements, text and comments.") In all current engines. Firefox1+Safari1.2+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ -`` node . `[childNodes](https://dom.spec.whatwg.org/#dom-node-childnodes)` `` +``node . `[childNodes](https://dom.spec.whatwg.org/#dom-node-childnodes)` `` Returns the [children](https://dom.spec.whatwg.org/#concept-tree-child). @@ -4297,41 +4637,41 @@ In all current engines. Firefox1+Safari7+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari7+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` node . `[firstChild](https://dom.spec.whatwg.org/#dom-node-firstchild)` `` +``node . `[firstChild](https://dom.spec.whatwg.org/#dom-node-firstchild)` `` Returns the [first child](https://dom.spec.whatwg.org/#concept-tree-first-child). -[Node/lastChild](https://developer.mozilla.org/en-US/docs/Web/API/Node/lastChild 'The read-only lastChild property of the Node interface returns the last child of the node. If its parent is an element, then the child is generally an element node, a text node, or a comment node. It returns null if there are no child elements.') +[Node/lastChild](https://developer.mozilla.org/en-US/docs/Web/API/Node/lastChild "The read-only lastChild property of the Node interface returns the last child of the node. If its parent is an element, then the child is generally an element node, a text node, or a comment node. It returns null if there are no child elements.") In all current engines. Firefox1+Safari7+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android45+iOS Safari7+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` node . `[lastChild](https://dom.spec.whatwg.org/#dom-node-lastchild)` `` +``node . `[lastChild](https://dom.spec.whatwg.org/#dom-node-lastchild)` `` Returns the [last child](https://dom.spec.whatwg.org/#concept-tree-last-child). @@ -4341,19 +4681,19 @@ In all current engines. Firefox1+Safari7+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE5.5+ ---- +___ Firefox for Android4+iOS Safari7+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` node . `[previousSibling](https://dom.spec.whatwg.org/#dom-node-previoussibling)` `` +``node . `[previousSibling](https://dom.spec.whatwg.org/#dom-node-previoussibling)` `` Returns the [previous sibling](https://dom.spec.whatwg.org/#concept-tree-previous-sibling). @@ -4363,19 +4703,19 @@ In all current engines. Firefox1+Safari1.1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE5.5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ -`` node . `[nextSibling](https://dom.spec.whatwg.org/#dom-node-nextsibling)` `` +``node . `[nextSibling](https://dom.spec.whatwg.org/#dom-node-nextsibling)` `` Returns the [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling). @@ -4403,23 +4743,23 @@ The `previousSibling` getter steps are to return [this](https://webidl.spec.what The `nextSibling` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling). ---- +___ -[Node/nodeValue](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue 'The nodeValue property of the Node interface returns or sets the value of the current node.') +[Node/nodeValue](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue "The nodeValue property of the Node interface returns or sets the value of the current node.") In all current engines. Firefox1+Safari7+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari7+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -4451,21 +4791,21 @@ Otherwise Do nothing. -[Node/textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent 'The textContent property of the Node interface represents the text content of the node and its descendants.') +[Node/textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent "The textContent property of the Node interface represents the text content of the node and its descendants.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -4492,8 +4832,11 @@ Null. To string replace all with a string string within a [node](https://dom.spec.whatwg.org/#concept-node) parent, run these steps: 1. Let node be null. + 2. If string is not the empty string, then set node to a new `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node) whose [data](https://dom.spec.whatwg.org/#concept-cd-data) is string and [node document](https://dom.spec.whatwg.org/#concept-node-document) is parent’s [node document](https://dom.spec.whatwg.org/#concept-node-document). + 3. [Replace all](https://dom.spec.whatwg.org/#concept-node-replace-all) with node within parent. + The `[textContent](https://dom.spec.whatwg.org/#dom-node-textcontent)` setter steps are to, if the given value is null, act as if it was the empty string instead, and then do as described below, switching on the interface [this](https://webidl.spec.whatwg.org/#this) [implements](https://webidl.spec.whatwg.org/#implements): @@ -4515,27 +4858,27 @@ Otherwise Do nothing. ---- +___ -[Node/normalize](https://developer.mozilla.org/en-US/docs/Web/API/Node/normalize 'The normalize() method of the Node 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.') +[Node/normalize](https://developer.mozilla.org/en-US/docs/Web/API/Node/normalize "The normalize() method of the Node 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.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` node . `[normalize()](https://dom.spec.whatwg.org/#dom-node-normalize)` `` +``node . `[normalize()](https://dom.spec.whatwg.org/#dom-node-normalize)` `` Removes [empty](https://dom.spec.whatwg.org/#concept-node-empty) [exclusive `Text` nodes](https://dom.spec.whatwg.org/#exclusive-text-node) and concatenates the [data](https://dom.spec.whatwg.org/#concept-cd-data) of remaining [contiguous exclusive `Text` nodes](https://dom.spec.whatwg.org/#contiguous-exclusive-text-nodes) into the first of their [nodes](https://dom.spec.whatwg.org/#concept-node). @@ -4547,33 +4890,38 @@ The `normalize()` method steps are to run these steps for each [descendant](http 4. [Replace data](https://dom.spec.whatwg.org/#concept-cd-replace) with node node, offset length, count 0, and data data. 5. Let currentNode be node’s [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling). 6. While currentNode is an [exclusive `Text` node](https://dom.spec.whatwg.org/#exclusive-text-node): - + 1. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is currentNode, add length to its [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) and set its [start node](https://dom.spec.whatwg.org/#concept-range-start-node) to node. + 2. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [end node](https://dom.spec.whatwg.org/#concept-range-end-node) is currentNode, add length to its [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) and set its [end node](https://dom.spec.whatwg.org/#concept-range-end-node) to node. + 3. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is currentNode’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) and [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) is currentNode’s [index](https://dom.spec.whatwg.org/#concept-tree-index), set its [start node](https://dom.spec.whatwg.org/#concept-range-start-node) to node and its [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) to length. + 4. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [end node](https://dom.spec.whatwg.org/#concept-range-end-node) is currentNode’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) and [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) is currentNode’s [index](https://dom.spec.whatwg.org/#concept-tree-index), set its [end node](https://dom.spec.whatwg.org/#concept-range-end-node) to node and its [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) to length. + 5. Add currentNode’s [length](https://dom.spec.whatwg.org/#concept-node-length) to length. + 6. Set currentNode to its [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling). - + 7. [Remove](https://dom.spec.whatwg.org/#concept-node-remove) node’s [contiguous exclusive `Text` nodes](https://dom.spec.whatwg.org/#contiguous-exclusive-text-nodes) (excluding itself), in [tree order](https://dom.spec.whatwg.org/#concept-tree-order). ---- +___ -[Node/cloneNode](https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode '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 a node is also cloned or not.') +[Node/cloneNode](https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode "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 a node is also cloned or not.") In all current engines. Firefox1+Safari1.1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -4581,25 +4929,25 @@ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung I Returns a copy of node. If deep is true, the copy also includes the node’s [descendants](https://dom.spec.whatwg.org/#concept-tree-descendant). -[Node/isEqualNode](https://developer.mozilla.org/en-US/docs/Web/API/Node/isEqualNode '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.') +[Node/isEqualNode](https://developer.mozilla.org/en-US/docs/Web/API/Node/isEqualNode "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.") In all current engines. Firefox2+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` node . `[isEqualNode(otherNode)](https://dom.spec.whatwg.org/#dom-node-isequalnode)` `` +``node . `[isEqualNode(otherNode)](https://dom.spec.whatwg.org/#dom-node-isequalnode)` `` Returns whether node and otherNode have the same properties. @@ -4610,43 +4958,47 @@ HTML defines [cloning steps](https://dom.spec.whatwg.org/#concept-node-clone-ext To clone a node, with an optional document and _clone children flag_, run these steps: 1. If document is not given, let document be node’s [node document](https://dom.spec.whatwg.org/#concept-node-document). + 2. If node is an [element](https://dom.spec.whatwg.org/#concept-element), then: - + 1. Let copy be the result of [creating an element](https://dom.spec.whatwg.org/#concept-create-element), given document, node’s [local name](https://dom.spec.whatwg.org/#concept-element-local-name), node’s [namespace](https://dom.spec.whatwg.org/#concept-element-namespace), node’s [namespace prefix](https://dom.spec.whatwg.org/#concept-element-namespace-prefix), and node’s [`is` value](https://dom.spec.whatwg.org/#concept-element-is-value), with the synchronous custom elements flag unset. + 2. [For each](https://infra.spec.whatwg.org/#list-iterate) attribute in node’s [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute): - + 1. Let copyAttribute be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of attribute. + 2. [Append](https://dom.spec.whatwg.org/#concept-element-attributes-append) copyAttribute to copy. - + 3. Otherwise, let copy be a [node](https://dom.spec.whatwg.org/#concept-node) that [implements](https://webidl.spec.whatwg.org/#implements) the same interfaces as node, and fulfills these additional requirements, switching on the interface node [implements](https://webidl.spec.whatwg.org/#implements): - + `[Document](https://dom.spec.whatwg.org/#document)` - + Set copy’s [encoding](https://dom.spec.whatwg.org/#concept-document-encoding), [content type](https://dom.spec.whatwg.org/#concept-document-content-type), [URL](https://dom.spec.whatwg.org/#concept-document-url), [origin](https://dom.spec.whatwg.org/#concept-document-origin), [type](https://dom.spec.whatwg.org/#concept-document-type), and [mode](https://dom.spec.whatwg.org/#concept-document-mode) to those of node. - + `[DocumentType](https://dom.spec.whatwg.org/#documenttype)` - + Set copy’s [name](https://dom.spec.whatwg.org/#concept-doctype-name), [public ID](https://dom.spec.whatwg.org/#concept-doctype-publicid), and [system ID](https://dom.spec.whatwg.org/#concept-doctype-systemid) to those of node. - + `[Attr](https://dom.spec.whatwg.org/#attr)` - + Set copy’s [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace), [namespace prefix](https://dom.spec.whatwg.org/#concept-attribute-namespace-prefix), [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name), and [value](https://dom.spec.whatwg.org/#concept-attribute-value) to those of node. - + `[Text](https://dom.spec.whatwg.org/#text)` - + `[Comment](https://dom.spec.whatwg.org/#comment)` - + Set copy’s [data](https://dom.spec.whatwg.org/#concept-cd-data) to that of node. - + `[ProcessingInstruction](https://dom.spec.whatwg.org/#processinginstruction)` - + Set copy’s [target](https://dom.spec.whatwg.org/#concept-pi-target) and [data](https://dom.spec.whatwg.org/#concept-cd-data) to those of node. - + Otherwise - + Do nothing. - + 4. Set copy’s [node document](https://dom.spec.whatwg.org/#concept-node-document) and document to copy, if copy is a [document](https://dom.spec.whatwg.org/#concept-document), and set copy’s [node document](https://dom.spec.whatwg.org/#concept-node-document) to document otherwise. + 5. Run any [cloning steps](https://dom.spec.whatwg.org/#concept-node-clone-ext) defined for node in [other applicable specifications](https://dom.spec.whatwg.org/#other-applicable-specifications) and pass copy, node, document and the _clone children flag_ if set, as parameters. 6. If the _clone children flag_ is set, [clone](https://dom.spec.whatwg.org/#concept-node-clone) all the [children](https://dom.spec.whatwg.org/#concept-tree-child) of node and append them to copy, with document as specified and the _clone children flag_ being set. 7. Return copy. @@ -4654,86 +5006,92 @@ To clone a node, with an optional document and _clone children flag_, run these The `cloneNode(deep)` method steps are: 1. If [this](https://webidl.spec.whatwg.org/#this) is a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. Return a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of [this](https://webidl.spec.whatwg.org/#this), with the _clone children flag_ set if deep is true. + A [node](https://dom.spec.whatwg.org/#concept-node) A equals a [node](https://dom.spec.whatwg.org/#concept-node) B if all of the following conditions are true: - A and B [implement](https://webidl.spec.whatwg.org/#implements) the same interfaces. + - The following are equal, switching on the interface A [implements](https://webidl.spec.whatwg.org/#implements): - + `[DocumentType](https://dom.spec.whatwg.org/#documenttype)` - + Its [name](https://dom.spec.whatwg.org/#concept-doctype-name), [public ID](https://dom.spec.whatwg.org/#concept-doctype-publicid), and [system ID](https://dom.spec.whatwg.org/#concept-doctype-systemid). - + `[Element](https://dom.spec.whatwg.org/#element)` - + Its [namespace](https://dom.spec.whatwg.org/#concept-element-namespace), [namespace prefix](https://dom.spec.whatwg.org/#concept-element-namespace-prefix), [local name](https://dom.spec.whatwg.org/#concept-element-local-name), and its [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute)’s [size](https://infra.spec.whatwg.org/#list-size). - + `[Attr](https://dom.spec.whatwg.org/#attr)` - + Its [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace), [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name), and [value](https://dom.spec.whatwg.org/#concept-attribute-value). - + `[ProcessingInstruction](https://dom.spec.whatwg.org/#processinginstruction)` - + Its [target](https://dom.spec.whatwg.org/#concept-pi-target) and [data](https://dom.spec.whatwg.org/#concept-cd-data). - + `[Text](https://dom.spec.whatwg.org/#text)` - + `[Comment](https://dom.spec.whatwg.org/#comment)` - + Its [data](https://dom.spec.whatwg.org/#concept-cd-data). - + Otherwise - + — - + - If A is an [element](https://dom.spec.whatwg.org/#concept-element), each [attribute](https://dom.spec.whatwg.org/#concept-attribute) in its [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute) has an [attribute](https://dom.spec.whatwg.org/#concept-attribute) that [equals](https://dom.spec.whatwg.org/#concept-node-equals) an [attribute](https://dom.spec.whatwg.org/#concept-attribute) in B’s [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute). + - A and B have the same number of [children](https://dom.spec.whatwg.org/#concept-tree-child). + - Each [child](https://dom.spec.whatwg.org/#concept-tree-child) of A [equals](https://dom.spec.whatwg.org/#concept-node-equals) the [child](https://dom.spec.whatwg.org/#concept-tree-child) of B at the identical [index](https://dom.spec.whatwg.org/#concept-tree-index). + The `isEqualNode(otherNode)` method steps are to return true if otherNode is non-null and [this](https://webidl.spec.whatwg.org/#this) [equals](https://dom.spec.whatwg.org/#concept-node-equals) otherNode; otherwise false. -[Node/isSameNode](https://developer.mozilla.org/en-US/docs/Web/API/Node/isSameNode '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).') +[Node/isSameNode](https://developer.mozilla.org/en-US/docs/Web/API/Node/isSameNode "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).") In all current engines. Firefox48+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android48+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `isSameNode(otherNode)` method steps are to return true if otherNode is [this](https://webidl.spec.whatwg.org/#this); otherwise false. ---- +___ -[Node/compareDocumentPosition](https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition 'The compareDocumentPosition() method of the Node interface reports the position of its argument node relative to the node on which it is called.') +[Node/compareDocumentPosition](https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition "The compareDocumentPosition() method of the Node interface reports the position of its argument node relative to the node on which it is called.") In all current engines. Firefox9+Safari4+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android9+iOS Safari3.2+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile12.1+ -`` node . `[compareDocumentPosition(other)](https://dom.spec.whatwg.org/#dom-node-comparedocumentposition)` `` +``node . `[compareDocumentPosition(other)](https://dom.spec.whatwg.org/#dom-node-comparedocumentposition)` `` Returns a bitmask indicating the position of other relative to node. These are the bits that can be set: @@ -4763,19 +5121,19 @@ In all current engines. Firefox9+Safari1.1+Chrome16+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android9+iOS Safari1+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile10.1+ -`` node . `[contains(other)](https://dom.spec.whatwg.org/#dom-node-contains)` `` +``node . `[contains(other)](https://dom.spec.whatwg.org/#dom-node-contains)` `` Returns true if other is an [inclusive descendant](https://dom.spec.whatwg.org/#concept-tree-inclusive-descendant) of node; otherwise false. @@ -4791,55 +5149,74 @@ These are the constants `[compareDocumentPosition()](https://dom.spec.whatwg.org The `compareDocumentPosition(other)` method steps are: 1. If [this](https://webidl.spec.whatwg.org/#this) is other, then return zero. + 2. Let node1 be other and node2 be [this](https://webidl.spec.whatwg.org/#this). + 3. Let attr1 and attr2 be null. + 4. If node1 is an [attribute](https://dom.spec.whatwg.org/#concept-attribute), then set attr1 to node1 and node1 to attr1’s [element](https://dom.spec.whatwg.org/#concept-attribute-element). + 5. If node2 is an [attribute](https://dom.spec.whatwg.org/#concept-attribute), then: - + 1. Set attr2 to node2 and node2 to attr2’s [element](https://dom.spec.whatwg.org/#concept-attribute-element). + 2. If attr1 and node1 are non-null, and node2 is node1, then: - + 1. [For each](https://infra.spec.whatwg.org/#list-iterate) attr in node2’s [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute): - + 1. If attr [equals](https://dom.spec.whatwg.org/#concept-node-equals) attr1, then return the result of adding `[DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC](https://dom.spec.whatwg.org/#dom-node-document_position_implementation_specific)` and `[DOCUMENT_POSITION_PRECEDING](https://dom.spec.whatwg.org/#dom-node-document_position_preceding)`. + 2. If attr [equals](https://dom.spec.whatwg.org/#concept-node-equals) attr2, then return the result of adding `[DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC](https://dom.spec.whatwg.org/#dom-node-document_position_implementation_specific)` and `[DOCUMENT_POSITION_FOLLOWING](https://dom.spec.whatwg.org/#dom-node-document_position_following)`. - + 6. If node1 or node2 is null, or node1’s [root](https://dom.spec.whatwg.org/#concept-tree-root) is not node2’s [root](https://dom.spec.whatwg.org/#concept-tree-root), then return the result of adding `[DOCUMENT_POSITION_DISCONNECTED](https://dom.spec.whatwg.org/#dom-node-document_position_disconnected)`, `[DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC](https://dom.spec.whatwg.org/#dom-node-document_position_implementation_specific)`, and either `[DOCUMENT_POSITION_PRECEDING](https://dom.spec.whatwg.org/#dom-node-document_position_preceding)` or `[DOCUMENT_POSITION_FOLLOWING](https://dom.spec.whatwg.org/#dom-node-document_position_following)`, with the constraint that this is to be consistent, together. - + Whether to return `[DOCUMENT_POSITION_PRECEDING](https://dom.spec.whatwg.org/#dom-node-document_position_preceding)` or `[DOCUMENT_POSITION_FOLLOWING](https://dom.spec.whatwg.org/#dom-node-document_position_following)` is typically implemented via pointer comparison. In JavaScript implementations a cached `Math.random()` value can be used. - + 7. If node1 is an [ancestor](https://dom.spec.whatwg.org/#concept-tree-ancestor) of node2 and attr1 is null, or node1 is node2 and attr2 is non-null, then return the result of adding `[DOCUMENT_POSITION_CONTAINS](https://dom.spec.whatwg.org/#dom-node-document_position_contains)` to `[DOCUMENT_POSITION_PRECEDING](https://dom.spec.whatwg.org/#dom-node-document_position_preceding)`. + 8. If node1 is a [descendant](https://dom.spec.whatwg.org/#concept-tree-descendant) of node2 and attr2 is null, or node1 is node2 and attr1 is non-null, then return the result of adding `[DOCUMENT_POSITION_CONTAINED_BY](https://dom.spec.whatwg.org/#dom-node-document_position_contained_by)` to `[DOCUMENT_POSITION_FOLLOWING](https://dom.spec.whatwg.org/#dom-node-document_position_following)`. + 9. If node1 is [preceding](https://dom.spec.whatwg.org/#concept-tree-preceding) node2, then return `[DOCUMENT_POSITION_PRECEDING](https://dom.spec.whatwg.org/#dom-node-document_position_preceding)`. - + Due to the way [attributes](https://dom.spec.whatwg.org/#concept-attribute) are handled in this algorithm this results in a [node](https://dom.spec.whatwg.org/#concept-node)’s [attributes](https://dom.spec.whatwg.org/#concept-attribute) counting as [preceding](https://dom.spec.whatwg.org/#concept-tree-preceding) that [node](https://dom.spec.whatwg.org/#concept-node)’s [children](https://dom.spec.whatwg.org/#concept-tree-child), despite [attributes](https://dom.spec.whatwg.org/#concept-attribute) not [participating](https://dom.spec.whatwg.org/#concept-tree-participate) in the same [tree](https://dom.spec.whatwg.org/#concept-tree). - -10. Return `[DOCUMENT_POSITION_FOLLOWING](https://dom.spec.whatwg.org/#dom-node-document_position_following)`. + +10. Return `[DOCUMENT_POSITION_FOLLOWING](https://dom.spec.whatwg.org/#dom-node-document_position_following)`. + The `contains(other)` method steps are to return true if other is an [inclusive descendant](https://dom.spec.whatwg.org/#concept-tree-inclusive-descendant) of [this](https://webidl.spec.whatwg.org/#this); otherwise false (including when other is null). ---- +___ To locate a namespace prefix for an element using namespace, run these steps: 1. If element’s [namespace](https://dom.spec.whatwg.org/#concept-element-namespace) is namespace and its [namespace prefix](https://dom.spec.whatwg.org/#concept-element-namespace-prefix) is non-null, then return its [namespace prefix](https://dom.spec.whatwg.org/#concept-element-namespace-prefix). + 2. If element [has](https://dom.spec.whatwg.org/#concept-element-attribute-has) an [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [namespace prefix](https://dom.spec.whatwg.org/#concept-attribute-namespace-prefix) is "`xmlns`" and [value](https://dom.spec.whatwg.org/#concept-attribute-value) is namespace, then return element’s first such [attribute](https://dom.spec.whatwg.org/#concept-attribute)’s [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name). + 3. If element’s [parent element](https://dom.spec.whatwg.org/#parent-element) is not null, then return the result of running [locate a namespace prefix](https://dom.spec.whatwg.org/#locate-a-namespace-prefix) on that [element](https://dom.spec.whatwg.org/#concept-element) using namespace. + 4. Return null. + To locate a namespace for a node using prefix, switch on the interface node [implements](https://webidl.spec.whatwg.org/#implements): `[Element](https://dom.spec.whatwg.org/#element)` 1. If its [namespace](https://dom.spec.whatwg.org/#concept-element-namespace) is non-null and its [namespace prefix](https://dom.spec.whatwg.org/#concept-element-namespace-prefix) is prefix, then return [namespace](https://dom.spec.whatwg.org/#concept-element-namespace). + 2. If it [has](https://dom.spec.whatwg.org/#concept-element-attribute-has) an [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace) is the [XMLNS namespace](https://infra.spec.whatwg.org/#xmlns-namespace), [namespace prefix](https://dom.spec.whatwg.org/#concept-attribute-namespace-prefix) is "`xmlns`", and [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) is prefix, or if prefix is null and it [has](https://dom.spec.whatwg.org/#concept-element-attribute-has) an [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace) is the [XMLNS namespace](https://infra.spec.whatwg.org/#xmlns-namespace), [namespace prefix](https://dom.spec.whatwg.org/#concept-attribute-namespace-prefix) is null, and [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) is "`xmlns`", then return its [value](https://dom.spec.whatwg.org/#concept-attribute-value) if it is not the empty string, and null otherwise. + 3. If its [parent element](https://dom.spec.whatwg.org/#parent-element) is null, then return null. + 4. Return the result of running [locate a namespace](https://dom.spec.whatwg.org/#locate-a-namespace) on its [parent element](https://dom.spec.whatwg.org/#parent-element) using prefix. + `[Document](https://dom.spec.whatwg.org/#document)` 1. If its [document element](https://dom.spec.whatwg.org/#document-element) is null, then return null. + 2. Return the result of running [locate a namespace](https://dom.spec.whatwg.org/#locate-a-namespace) on its [document element](https://dom.spec.whatwg.org/#document-element) using prefix. + `[DocumentType](https://dom.spec.whatwg.org/#documenttype)` @@ -4850,208 +5227,227 @@ Return null. `[Attr](https://dom.spec.whatwg.org/#attr)` 1. If its [element](https://dom.spec.whatwg.org/#concept-attribute-element) is null, then return null. + 2. Return the result of running [locate a namespace](https://dom.spec.whatwg.org/#locate-a-namespace) on its [element](https://dom.spec.whatwg.org/#concept-attribute-element) using prefix. + Otherwise 1. If its [parent element](https://dom.spec.whatwg.org/#parent-element) is null, then return null. + 2. Return the result of running [locate a namespace](https://dom.spec.whatwg.org/#locate-a-namespace) on its [parent element](https://dom.spec.whatwg.org/#parent-element) using prefix. + -[Node/lookupPrefix](https://developer.mozilla.org/en-US/docs/Web/API/Node/lookupPrefix '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.') +[Node/lookupPrefix](https://developer.mozilla.org/en-US/docs/Web/API/Node/lookupPrefix "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.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `lookupPrefix(namespace)` method steps are: 1. If namespace is null or the empty string, then return null. + 2. Switch on the interface [this](https://webidl.spec.whatwg.org/#this) [implements](https://webidl.spec.whatwg.org/#implements): - + `[Element](https://dom.spec.whatwg.org/#element)` - + Return the result of [locating a namespace prefix](https://dom.spec.whatwg.org/#locate-a-namespace-prefix) for it using namespace. - + `[Document](https://dom.spec.whatwg.org/#document)` - + Return the result of [locating a namespace prefix](https://dom.spec.whatwg.org/#locate-a-namespace-prefix) for its [document element](https://dom.spec.whatwg.org/#document-element), if its [document element](https://dom.spec.whatwg.org/#document-element) is non-null; otherwise null. - + `[DocumentType](https://dom.spec.whatwg.org/#documenttype)` - + `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` - + Return null. - + `[Attr](https://dom.spec.whatwg.org/#attr)` - + Return the result of [locating a namespace prefix](https://dom.spec.whatwg.org/#locate-a-namespace-prefix) for its [element](https://dom.spec.whatwg.org/#concept-attribute-element), if its [element](https://dom.spec.whatwg.org/#concept-attribute-element) is non-null; otherwise null. - + Otherwise - + Return the result of [locating a namespace prefix](https://dom.spec.whatwg.org/#locate-a-namespace-prefix) for its [parent element](https://dom.spec.whatwg.org/#parent-element), if its [parent element](https://dom.spec.whatwg.org/#parent-element) is non-null; otherwise null. + -[Node/lookupNamespaceURI](https://developer.mozilla.org/en-US/docs/Web/API/Node/lookupNamespaceURI '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).') +[Node/lookupNamespaceURI](https://developer.mozilla.org/en-US/docs/Web/API/Node/lookupNamespaceURI "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).") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `lookupNamespaceURI(prefix)` method steps are: 1. If prefix is the empty string, then set it to null. + 2. Return the result of running [locate a namespace](https://dom.spec.whatwg.org/#locate-a-namespace) for [this](https://webidl.spec.whatwg.org/#this) using prefix. + -[Node/isDefaultNamespace](https://developer.mozilla.org/en-US/docs/Web/API/Node/isDefaultNamespace '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.') +[Node/isDefaultNamespace](https://developer.mozilla.org/en-US/docs/Web/API/Node/isDefaultNamespace "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.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `isDefaultNamespace(namespace)` method steps are: 1. If namespace is the empty string, then set it to null. + 2. Let defaultNamespace be the result of running [locate a namespace](https://dom.spec.whatwg.org/#locate-a-namespace) for [this](https://webidl.spec.whatwg.org/#this) using null. + 3. Return true if defaultNamespace is the same as namespace; otherwise false. + ---- +___ -[Node/insertBefore](https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore 'The insertBefore() method of the Node interface inserts a node before a reference node as a child of a specified parent node.') +[Node/insertBefore](https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore "The insertBefore() method of the Node interface inserts a node before a reference node as a child of a specified parent node.") In all current engines. Firefox3+Safari1.1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `insertBefore(node, child)` method steps are to return the result of [pre-inserting](https://dom.spec.whatwg.org/#concept-node-pre-insert) node into [this](https://webidl.spec.whatwg.org/#this) before child. -[Node/appendChild](https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild 'The appendChild() method of the Node interface adds a node to the end of the list of children of a specified parent node. If the given child is a reference to an existing node in the document, appendChild() moves it from its current position to the new position (there is no requirement to remove the node from its parent node before appending it to some other node).') +[Node/appendChild](https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild "The appendChild() method of the Node interface adds a node to the end of the list of children of a specified parent node. If the given child is a reference to an existing node in the document, appendChild() moves it from its current position to the new position (there is no requirement to remove the node from its parent node before appending it to some other node).") In all current engines. Firefox1+Safari1.1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `appendChild(node)` method steps are to return the result of [appending](https://dom.spec.whatwg.org/#concept-node-append) node to [this](https://webidl.spec.whatwg.org/#this). -[Node/replaceChild](https://developer.mozilla.org/en-US/docs/Web/API/Node/replaceChild 'The replaceChild() method of the Node element replaces a child node within the given (parent) node.') +[Node/replaceChild](https://developer.mozilla.org/en-US/docs/Web/API/Node/replaceChild "The replaceChild() method of the Node element replaces a child node within the given (parent) node.") In all current engines. Firefox1+Safari1.1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `replaceChild(node, child)` method steps are to return the result of [replacing](https://dom.spec.whatwg.org/#concept-node-replace) child with node within [this](https://webidl.spec.whatwg.org/#this). -[Node/removeChild](https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild 'The removeChild() method of the Node interface removes a child node from the DOM and returns the removed node.') +[Node/removeChild](https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild "The removeChild() method of the Node interface removes a child node from the DOM and returns the removed node.") In all current engines. Firefox1+Safari1.1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `removeChild(child)` method steps are to return the result of [pre-removing](https://dom.spec.whatwg.org/#concept-node-pre-remove) child from [this](https://webidl.spec.whatwg.org/#this). ---- +___ The list of elements with qualified name qualifiedName for a [node](https://dom.spec.whatwg.org/#concept-node) root is the `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` returned by the following algorithm: 1. If qualifiedName is U+002A (\*), then return a `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` rooted at root, whose filter matches only [descendant](https://dom.spec.whatwg.org/#concept-tree-descendant) [elements](https://dom.spec.whatwg.org/#concept-element). + 2. Otherwise, if root’s [node document](https://dom.spec.whatwg.org/#concept-node-document) is an [HTML document](https://dom.spec.whatwg.org/#html-document), return a `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` rooted at root, whose filter matches the following [descendant](https://dom.spec.whatwg.org/#concept-tree-descendant) [elements](https://dom.spec.whatwg.org/#concept-element): - + - Whose [namespace](https://dom.spec.whatwg.org/#concept-element-namespace) is the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and whose [qualified name](https://dom.spec.whatwg.org/#concept-element-qualified-name) is qualifiedName, in [ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase). + - Whose [namespace](https://dom.spec.whatwg.org/#concept-element-namespace) is _not_ the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and whose [qualified name](https://dom.spec.whatwg.org/#concept-element-qualified-name) is qualifiedName. - + 3. Otherwise, return a `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` rooted at root, whose filter matches [descendant](https://dom.spec.whatwg.org/#concept-tree-descendant) [elements](https://dom.spec.whatwg.org/#concept-element) whose [qualified name](https://dom.spec.whatwg.org/#concept-element-qualified-name) is qualifiedName. + When invoked with the same argument, and as long as root’s [node document](https://dom.spec.whatwg.org/#concept-node-document)’s [type](https://dom.spec.whatwg.org/#concept-document-type) has not changed, the same `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` object may be returned as returned by an earlier call. The list of elements with namespace namespace and local name localName for a [node](https://dom.spec.whatwg.org/#concept-node) root is the `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` returned by the following algorithm: 1. If namespace is the empty string, then set it to null. + 2. If both namespace and localName are U+002A (\*), then return a `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` rooted at root, whose filter matches [descendant](https://dom.spec.whatwg.org/#concept-tree-descendant) [elements](https://dom.spec.whatwg.org/#concept-element). + 3. If namespace is U+002A (\*), then return a `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` rooted at root, whose filter matches [descendant](https://dom.spec.whatwg.org/#concept-tree-descendant) [elements](https://dom.spec.whatwg.org/#concept-element) whose [local name](https://dom.spec.whatwg.org/#concept-element-local-name) is localName. + 4. If localName is U+002A (\*), then return a `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` rooted at root, whose filter matches [descendant](https://dom.spec.whatwg.org/#concept-tree-descendant) [elements](https://dom.spec.whatwg.org/#concept-element) whose [namespace](https://dom.spec.whatwg.org/#concept-element-namespace) is namespace. + 5. Return a `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` rooted at root, whose filter matches [descendant](https://dom.spec.whatwg.org/#concept-tree-descendant) [elements](https://dom.spec.whatwg.org/#concept-element) whose [namespace](https://dom.spec.whatwg.org/#concept-element-namespace) is namespace and [local name](https://dom.spec.whatwg.org/#concept-element-local-name) is localName. + When invoked with the same arguments, the same `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` object may be returned as returned by an earlier call. @@ -5060,8 +5456,9 @@ The list of elements with class names classNames for a [node](https://dom.spec.w 1. Let classes be the result of running the [ordered set parser](https://dom.spec.whatwg.org/#concept-ordered-set-parser) on classNames. 2. If classes is the empty set, return an empty `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)`. 3. Return a `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` rooted at root, whose filter matches [descendant](https://dom.spec.whatwg.org/#concept-tree-descendant) [elements](https://dom.spec.whatwg.org/#concept-element) that have all their [classes](https://dom.spec.whatwg.org/#concept-class) in classes. - + The comparisons for the [classes](https://dom.spec.whatwg.org/#concept-class) must be done in an [ASCII case-insensitive](https://infra.spec.whatwg.org/#ascii-case-insensitive) manner if root’s [node document](https://dom.spec.whatwg.org/#concept-node-document)’s [mode](https://dom.spec.whatwg.org/#concept-document-mode) is "`quirks`"; otherwise in an [identical to](https://infra.spec.whatwg.org/#string-is) manner. + When invoked with the same argument, the same `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` object may be returned as returned by an earlier call. @@ -5073,83 +5470,83 @@ In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera3+Edge79+ ---- +___ Edge (Legacy)12+IE4+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ -[XMLDocument](https://developer.mozilla.org/en-US/docs/Web/API/XMLDocument '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.') +[XMLDocument](https://developer.mozilla.org/en-US/docs/Web/API/XMLDocument "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.") In all current engines. Firefox1+Safari10+Chrome34+ ---- +___ Opera21+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari10+Chrome for Android34+Android WebView37+Samsung Internet2.0+Opera Mobile21+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `Document` : [Node](https://dom.spec.whatwg.org/#node) { -[constructor](https://dom.spec.whatwg.org/#dom-document-document)(); - -\[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [DOMImplementation](https://dom.spec.whatwg.org/#domimplementation) [implementation](https://dom.spec.whatwg.org/#dom-document-implementation); -readonly attribute [USVString](https://webidl.spec.whatwg.org/#idl-USVString) [URL](https://dom.spec.whatwg.org/#dom-document-url); -readonly attribute [USVString](https://webidl.spec.whatwg.org/#idl-USVString) [documentURI](https://dom.spec.whatwg.org/#dom-document-documenturi); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [compatMode](https://dom.spec.whatwg.org/#dom-document-compatmode); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [characterSet](https://dom.spec.whatwg.org/#dom-document-characterset); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [charset](https://dom.spec.whatwg.org/#dom-document-charset); // legacy alias of .characterSet -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [inputEncoding](https://dom.spec.whatwg.org/#dom-document-inputencoding); // legacy alias of .characterSet -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [contentType](https://dom.spec.whatwg.org/#dom-document-contenttype); - -readonly attribute [DocumentType](https://dom.spec.whatwg.org/#documenttype)? [doctype](https://dom.spec.whatwg.org/#dom-document-doctype); -readonly attribute [Element](https://dom.spec.whatwg.org/#element)? [documentElement](https://dom.spec.whatwg.org/#dom-document-documentelement); -[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection) [getElementsByTagName](https://dom.spec.whatwg.org/#dom-document-getelementsbytagname)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-document-getelementsbytagname-qualifiedname-qualifiedname)); -[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection) [getElementsByTagNameNS](https://dom.spec.whatwg.org/#dom-document-getelementsbytagnamens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-document-getelementsbytagnamens-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-document-getelementsbytagnamens-namespace-localname-localname)); -[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection) [getElementsByClassName](https://dom.spec.whatwg.org/#dom-document-getelementsbyclassname)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `classNames`[](https://dom.spec.whatwg.org/#dom-document-getelementsbyclassname-classnames-classnames)); - -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Element](https://dom.spec.whatwg.org/#element) [createElement](https://dom.spec.whatwg.org/#dom-document-createelement)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-document-createelement-localname-options-localname), optional ([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) or [ElementCreationOptions](https://dom.spec.whatwg.org/#dictdef-elementcreationoptions)) `options`[](https://dom.spec.whatwg.org/#dom-document-createelement-localname-options-options) = {}); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Element](https://dom.spec.whatwg.org/#element) [createElementNS](https://dom.spec.whatwg.org/#dom-document-createelementns)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-document-createelementns-namespace-qualifiedname-options-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-document-createelementns-namespace-qualifiedname-options-qualifiedname), optional ([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) or [ElementCreationOptions](https://dom.spec.whatwg.org/#dictdef-elementcreationoptions)) `options`[](https://dom.spec.whatwg.org/#dom-document-createelementns-namespace-qualifiedname-options-options) = {}); -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [DocumentFragment](https://dom.spec.whatwg.org/#documentfragment) [createDocumentFragment](https://dom.spec.whatwg.org/#dom-document-createdocumentfragment)(); -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Text](https://dom.spec.whatwg.org/#text) [createTextNode](https://dom.spec.whatwg.org/#dom-document-createtextnode)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-document-createtextnode-data-data)); -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [CDATASection](https://dom.spec.whatwg.org/#cdatasection) [createCDATASection](https://dom.spec.whatwg.org/#dom-document-createcdatasection)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-document-createcdatasection-data-data)); -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Comment](https://dom.spec.whatwg.org/#comment) [createComment](https://dom.spec.whatwg.org/#dom-document-createcomment)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) ); -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [ProcessingInstruction](https://dom.spec.whatwg.org/#processinginstruction) [createProcessingInstruction](https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `target`[](https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction-target-data-target), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction-target-data-data)); - -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Node](https://dom.spec.whatwg.org/#node) [importNode](https://dom.spec.whatwg.org/#dom-document-importnode)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-document-importnode-node-deep-node), optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `deep`[](https://dom.spec.whatwg.org/#dom-document-importnode-node-deep-deep) = false); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Node](https://dom.spec.whatwg.org/#node) [adoptNode](https://dom.spec.whatwg.org/#dom-document-adoptnode)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-document-adoptnode-node-node)); - -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Attr](https://dom.spec.whatwg.org/#attr) [createAttribute](https://dom.spec.whatwg.org/#dom-document-createattribute)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-document-createattribute-localname-localname)); -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Attr](https://dom.spec.whatwg.org/#attr) [createAttributeNS](https://dom.spec.whatwg.org/#dom-document-createattributens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-document-createattributens-namespace-qualifiedname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-document-createattributens-namespace-qualifiedname-qualifiedname)); - -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Event](https://dom.spec.whatwg.org/#event) [createEvent](https://dom.spec.whatwg.org/#dom-document-createevent)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `interface`[](https://dom.spec.whatwg.org/#dom-document-createevent-interface-interface)); // legacy - -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Range](https://dom.spec.whatwg.org/#range) [createRange](https://dom.spec.whatwg.org/#dom-document-createrange)(); - -// NodeFilter.SHOW_ALL = 0xFFFFFFFF -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [NodeIterator](https://dom.spec.whatwg.org/#nodeiterator) [createNodeIterator](https://dom.spec.whatwg.org/#dom-document-createnodeiterator)([Node](https://dom.spec.whatwg.org/#node) `root`[](https://dom.spec.whatwg.org/#dom-document-createnodeiterator-root-whattoshow-filter-root), optional [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `whatToShow`[](https://dom.spec.whatwg.org/#dom-document-createnodeiterator-root-whattoshow-filter-whattoshow) = 0xFFFFFFFF, optional [NodeFilter](https://dom.spec.whatwg.org/#callbackdef-nodefilter)? `filter`[](https://dom.spec.whatwg.org/#dom-document-createnodeiterator-root-whattoshow-filter-filter) = null); -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [TreeWalker](https://dom.spec.whatwg.org/#treewalker) [createTreeWalker](https://dom.spec.whatwg.org/#dom-document-createtreewalker)([Node](https://dom.spec.whatwg.org/#node) `root`[](https://dom.spec.whatwg.org/#dom-document-createtreewalker-root-whattoshow-filter-root), optional [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `whatToShow`[](https://dom.spec.whatwg.org/#dom-document-createtreewalker-root-whattoshow-filter-whattoshow) = 0xFFFFFFFF, optional [NodeFilter](https://dom.spec.whatwg.org/#callbackdef-nodefilter)? `filter`[](https://dom.spec.whatwg.org/#dom-document-createtreewalker-root-whattoshow-filter-filter) = null); + [constructor](https://dom.spec.whatwg.org/#dom-document-document)(); + + \[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [DOMImplementation](https://dom.spec.whatwg.org/#domimplementation) [implementation](https://dom.spec.whatwg.org/#dom-document-implementation); + readonly attribute [USVString](https://webidl.spec.whatwg.org/#idl-USVString) [URL](https://dom.spec.whatwg.org/#dom-document-url); + readonly attribute [USVString](https://webidl.spec.whatwg.org/#idl-USVString) [documentURI](https://dom.spec.whatwg.org/#dom-document-documenturi); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [compatMode](https://dom.spec.whatwg.org/#dom-document-compatmode); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [characterSet](https://dom.spec.whatwg.org/#dom-document-characterset); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [charset](https://dom.spec.whatwg.org/#dom-document-charset); // legacy alias of .characterSet + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [inputEncoding](https://dom.spec.whatwg.org/#dom-document-inputencoding); // legacy alias of .characterSet + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [contentType](https://dom.spec.whatwg.org/#dom-document-contenttype); + + readonly attribute [DocumentType](https://dom.spec.whatwg.org/#documenttype)? [doctype](https://dom.spec.whatwg.org/#dom-document-doctype); + readonly attribute [Element](https://dom.spec.whatwg.org/#element)? [documentElement](https://dom.spec.whatwg.org/#dom-document-documentelement); + [HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection) [getElementsByTagName](https://dom.spec.whatwg.org/#dom-document-getelementsbytagname)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-document-getelementsbytagname-qualifiedname-qualifiedname)); + [HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection) [getElementsByTagNameNS](https://dom.spec.whatwg.org/#dom-document-getelementsbytagnamens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-document-getelementsbytagnamens-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-document-getelementsbytagnamens-namespace-localname-localname)); + [HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection) [getElementsByClassName](https://dom.spec.whatwg.org/#dom-document-getelementsbyclassname)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `classNames`[](https://dom.spec.whatwg.org/#dom-document-getelementsbyclassname-classnames-classnames)); + + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Element](https://dom.spec.whatwg.org/#element) [createElement](https://dom.spec.whatwg.org/#dom-document-createelement)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-document-createelement-localname-options-localname), optional ([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) or [ElementCreationOptions](https://dom.spec.whatwg.org/#dictdef-elementcreationoptions)) `options`[](https://dom.spec.whatwg.org/#dom-document-createelement-localname-options-options) = {}); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Element](https://dom.spec.whatwg.org/#element) [createElementNS](https://dom.spec.whatwg.org/#dom-document-createelementns)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-document-createelementns-namespace-qualifiedname-options-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-document-createelementns-namespace-qualifiedname-options-qualifiedname), optional ([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) or [ElementCreationOptions](https://dom.spec.whatwg.org/#dictdef-elementcreationoptions)) `options`[](https://dom.spec.whatwg.org/#dom-document-createelementns-namespace-qualifiedname-options-options) = {}); + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [DocumentFragment](https://dom.spec.whatwg.org/#documentfragment) [createDocumentFragment](https://dom.spec.whatwg.org/#dom-document-createdocumentfragment)(); + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Text](https://dom.spec.whatwg.org/#text) [createTextNode](https://dom.spec.whatwg.org/#dom-document-createtextnode)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-document-createtextnode-data-data)); + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [CDATASection](https://dom.spec.whatwg.org/#cdatasection) [createCDATASection](https://dom.spec.whatwg.org/#dom-document-createcdatasection)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-document-createcdatasection-data-data)); + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Comment](https://dom.spec.whatwg.org/#comment) [createComment](https://dom.spec.whatwg.org/#dom-document-createcomment)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) ); + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [ProcessingInstruction](https://dom.spec.whatwg.org/#processinginstruction) [createProcessingInstruction](https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `target`[](https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction-target-data-target), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction-target-data-data)); + + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Node](https://dom.spec.whatwg.org/#node) [importNode](https://dom.spec.whatwg.org/#dom-document-importnode)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-document-importnode-node-deep-node), optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `deep`[](https://dom.spec.whatwg.org/#dom-document-importnode-node-deep-deep) = false); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Node](https://dom.spec.whatwg.org/#node) [adoptNode](https://dom.spec.whatwg.org/#dom-document-adoptnode)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-document-adoptnode-node-node)); + + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Attr](https://dom.spec.whatwg.org/#attr) [createAttribute](https://dom.spec.whatwg.org/#dom-document-createattribute)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-document-createattribute-localname-localname)); + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Attr](https://dom.spec.whatwg.org/#attr) [createAttributeNS](https://dom.spec.whatwg.org/#dom-document-createattributens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-document-createattributens-namespace-qualifiedname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-document-createattributens-namespace-qualifiedname-qualifiedname)); + + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Event](https://dom.spec.whatwg.org/#event) [createEvent](https://dom.spec.whatwg.org/#dom-document-createevent)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `interface`[](https://dom.spec.whatwg.org/#dom-document-createevent-interface-interface)); // legacy + + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Range](https://dom.spec.whatwg.org/#range) [createRange](https://dom.spec.whatwg.org/#dom-document-createrange)(); + + // NodeFilter.SHOW\_ALL = 0xFFFFFFFF + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [NodeIterator](https://dom.spec.whatwg.org/#nodeiterator) [createNodeIterator](https://dom.spec.whatwg.org/#dom-document-createnodeiterator)([Node](https://dom.spec.whatwg.org/#node) `root`[](https://dom.spec.whatwg.org/#dom-document-createnodeiterator-root-whattoshow-filter-root), optional [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `whatToShow`[](https://dom.spec.whatwg.org/#dom-document-createnodeiterator-root-whattoshow-filter-whattoshow) = 0xFFFFFFFF, optional [NodeFilter](https://dom.spec.whatwg.org/#callbackdef-nodefilter)? `filter`[](https://dom.spec.whatwg.org/#dom-document-createnodeiterator-root-whattoshow-filter-filter) = null); + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [TreeWalker](https://dom.spec.whatwg.org/#treewalker) [createTreeWalker](https://dom.spec.whatwg.org/#dom-document-createtreewalker)([Node](https://dom.spec.whatwg.org/#node) `root`[](https://dom.spec.whatwg.org/#dom-document-createtreewalker-root-whattoshow-filter-root), optional [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `whatToShow`[](https://dom.spec.whatwg.org/#dom-document-createtreewalker-root-whattoshow-filter-whattoshow) = 0xFFFFFFFF, optional [NodeFilter](https://dom.spec.whatwg.org/#callbackdef-nodefilter)? `filter`[](https://dom.spec.whatwg.org/#dom-document-createtreewalker-root-whattoshow-filter-filter) = null); }; \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `XMLDocument` : [Document](https://dom.spec.whatwg.org/#document) {}; dictionary `ElementCreationOptions` { -[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `is`; + [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `is`; }; `[Document](https://dom.spec.whatwg.org/#document)` [nodes](https://dom.spec.whatwg.org/#concept-node) are simply known as documents. @@ -5168,7 +5565,7 @@ The [mode](https://dom.spec.whatwg.org/#concept-document-mode) is only ever chan A [document](https://dom.spec.whatwg.org/#concept-document)’s [get the parent](https://dom.spec.whatwg.org/#get-the-parent) algorithm, given an event, returns null if event’s `[type](https://dom.spec.whatwg.org/#dom-event-type)` attribute value is "`load`" or [document](https://dom.spec.whatwg.org/#concept-document) does not have a [browsing context](https://html.spec.whatwg.org/multipage/browsers.html#concept-document-bc); otherwise the [document](https://dom.spec.whatwg.org/#concept-document)’s [relevant global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global). ---- +___ [Document/Document](https://developer.mozilla.org/en-US/docs/Web/API/Document/Document "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.") @@ -5176,105 +5573,105 @@ In all current engines. Firefox20+Safari8+Chrome60+ ---- +___ Opera47+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android20+iOS Safari8+Chrome for Android60+Android WebView60+Samsung Internet8.0+Opera Mobile44+ -`` document = new `[Document()](https://dom.spec.whatwg.org/#dom-document-document)` `` +``document = new `[Document()](https://dom.spec.whatwg.org/#dom-document-document)` `` Returns a new [document](https://dom.spec.whatwg.org/#concept-document). -[Document/implementation](https://developer.mozilla.org/en-US/docs/Web/API/Document/implementation 'The Document.implementation property returns a DOMImplementation object associated with the current document.') +[Document/implementation](https://developer.mozilla.org/en-US/docs/Web/API/Document/implementation "The Document.implementation property returns a DOMImplementation object associated with the current document.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` document . `[implementation](https://dom.spec.whatwg.org/#dom-document-implementation)` `` +``document . `[implementation](https://dom.spec.whatwg.org/#dom-document-implementation)` `` Returns document’s `[DOMImplementation](https://dom.spec.whatwg.org/#domimplementation)` object. -[Document/URL](https://developer.mozilla.org/en-US/docs/Web/API/Document/URL 'The URL read-only property of the Document interface returns the document location as a string.') +[Document/URL](https://developer.mozilla.org/en-US/docs/Web/API/Document/URL "The URL read-only property of the Document interface returns the document location as a string.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera3+Edge79+ ---- +___ Edge (Legacy)12+IE4+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ -`` document . `[URL](https://dom.spec.whatwg.org/#dom-document-url)` `` +``document . `[URL](https://dom.spec.whatwg.org/#dom-document-url)` `` -[Document/documentURI](https://developer.mozilla.org/en-US/docs/Web/API/Document/documentURI 'The documentURI read-only property of the Document interface returns the document location as a string.') +[Document/documentURI](https://developer.mozilla.org/en-US/docs/Web/API/Document/documentURI "The documentURI read-only property of the Document interface returns the document location as a string.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` document . `[documentURI](https://dom.spec.whatwg.org/#dom-document-documenturi)` `` +``document . `[documentURI](https://dom.spec.whatwg.org/#dom-document-documenturi)` `` Returns document’s [URL](https://dom.spec.whatwg.org/#concept-document-url). -[Document/compatMode](https://developer.mozilla.org/en-US/docs/Web/API/Document/compatMode 'The Document.compatMode read-only property indicates whether the document is rendered in Quirks mode or Standards mode.') +[Document/compatMode](https://developer.mozilla.org/en-US/docs/Web/API/Document/compatMode "The Document.compatMode read-only property indicates whether the document is rendered in Quirks mode or Standards mode.") In all current engines. Firefox1+Safari3.1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari2+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` document . `[compatMode](https://dom.spec.whatwg.org/#dom-document-compatmode)` `` +``document . `[compatMode](https://dom.spec.whatwg.org/#dom-document-compatmode)` `` Returns the string "`BackCompat`" if document’s [mode](https://dom.spec.whatwg.org/#concept-document-mode) is "`quirks`"; otherwise "`CSS1Compat`". @@ -5284,41 +5681,41 @@ In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera MobileYes -`` document . `[characterSet](https://dom.spec.whatwg.org/#dom-document-characterset)` `` +``document . `[characterSet](https://dom.spec.whatwg.org/#dom-document-characterset)` `` Returns document’s [encoding](https://dom.spec.whatwg.org/#concept-document-encoding). -[Document/contentType](https://developer.mozilla.org/en-US/docs/Web/API/Document/contentType '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.') +[Document/contentType](https://developer.mozilla.org/en-US/docs/Web/API/Document/contentType "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.") In all current engines. Firefox1+Safari9+Chrome36+ ---- +___ Opera23+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android4+iOS Safari9+Chrome for Android36+Android WebView37+Samsung Internet3.0+Opera Mobile24+ -`` document . `[contentType](https://dom.spec.whatwg.org/#dom-document-contenttype)` `` +``document . `[contentType](https://dom.spec.whatwg.org/#dom-document-contenttype)` `` Returns document’s [content type](https://dom.spec.whatwg.org/#concept-document-content-type). @@ -5336,23 +5733,23 @@ The `characterSet`, `charset`, and `inputEncoding` getter steps are to return [t The `contentType` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [content type](https://dom.spec.whatwg.org/#concept-document-content-type). ---- +___ -[Document/doctype](https://developer.mozilla.org/en-US/docs/Web/API/Document/doctype 'Returns the Document Type Declaration (DTD) associated with current document. The returned object implements the DocumentType interface. Use DOMImplementation.createDocumentType() to create a DocumentType.') +[Document/doctype](https://developer.mozilla.org/en-US/docs/Web/API/Document/doctype "Returns the Document Type Declaration (DTD) associated with current document. The returned object implements the DocumentType interface. Use DOMImplementation.createDocumentType() to create a DocumentType.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -5360,21 +5757,21 @@ document . `[doctype](https://dom.spec.whatwg.org/#dom-document-doctype)` Returns the [doctype](https://dom.spec.whatwg.org/#concept-doctype) or null if there is none. -[Document/documentElement](https://developer.mozilla.org/en-US/docs/Web/API/Document/documentElement 'Document.documentElement returns the Element that is the root element of the document (for example, the element for HTML documents).') +[Document/documentElement](https://developer.mozilla.org/en-US/docs/Web/API/Document/documentElement "Document.documentElement returns the Element that is the root element of the document (for example, the element for HTML documents).") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -5382,21 +5779,21 @@ document . `[documentElement](https://dom.spec.whatwg.org/#dom-document-document Returns the [document element](https://dom.spec.whatwg.org/#document-element). -[Document/getElementsByTagName](https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByTagName 'The getElementsByTagName method of Document interface returns an HTMLCollection of elements with the given tag name.') +[Document/getElementsByTagName](https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByTagName "The getElementsByTagName method of Document interface returns an HTMLCollection of elements with the given tag name.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera5.1+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -5406,21 +5803,21 @@ If qualifiedName is "`*`" returns a `[HTMLCollection](https://dom.spec.whatwg.or Otherwise, returns a `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` of all [descendant](https://dom.spec.whatwg.org/#concept-tree-descendant) [elements](https://dom.spec.whatwg.org/#concept-element) whose [qualified name](https://dom.spec.whatwg.org/#concept-element-qualified-name) is qualifiedName. (Matches case-insensitively against [elements](https://dom.spec.whatwg.org/#concept-element) in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) within an [HTML document](https://dom.spec.whatwg.org/#html-document).) -[Document/getElementsByTagNameNS](https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByTagNameNS 'Returns a list of elements with the given tag name belonging to the given namespace. The complete document is searched, including the root node.') +[Document/getElementsByTagNameNS](https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByTagNameNS "Returns a list of elements with the given tag name belonging to the given namespace. The complete document is searched, including the root node.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -5434,41 +5831,41 @@ If only localName is "`*`" returns a `[HTMLCollection](https://dom.spec.whatwg.o Otherwise, returns a `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` of all [descendant](https://dom.spec.whatwg.org/#concept-tree-descendant) [elements](https://dom.spec.whatwg.org/#concept-element) whose [namespace](https://dom.spec.whatwg.org/#concept-element-namespace) is namespace and [local name](https://dom.spec.whatwg.org/#concept-element-local-name) is localName. -[Document/getElementsByClassName](https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName 'The getElementsByClassName method of Document interface returns an array-like object of all child elements which have all of the given class name(s).') +[Document/getElementsByClassName](https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName "The getElementsByClassName method of Document interface returns an array-like object of all child elements which have all of the given class name(s).") In all current engines. Firefox3+Safari3.1+Chrome1+ ---- +___ Opera9.5+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari2+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ collection = document . `[getElementsByClassName(classNames)](https://dom.spec.whatwg.org/#dom-document-getelementsbyclassname)` -[Element/getElementsByClassName](https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName 'The Element method getElementsByClassName() returns a live HTMLCollection which contains every descendant element which has the specified class name or names.') +[Element/getElementsByClassName](https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName "The Element method getElementsByClassName() returns a live HTMLCollection which contains every descendant element which has the specified class name or names.") In all current engines. Firefox3+Safari6+Chrome1+ ---- +___ Opera9.5+Edge79+ ---- +___ Edge (Legacy)16+IENone ---- +___ Firefox for Android4+iOS Safari6+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -5500,11 +5897,11 @@ The `getElementsByClassName(classNames)` method steps are to return the [list of A call to `document.getElementById("example").getElementsByClassName("aaa")` would return a `[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection)` with the two paragraphs `p1` and `p2` in it. -A call to `getElementsByClassName("ccc bbb")` would only return one node, however, namely `p3`. A call to `document.getElementById("example").getElementsByClassName("bbb ccc ")` would return the same thing. +A call to `getElementsByClassName("ccc bbb")` would only return one node, however, namely `p3`. A call to `document.getElementById("example").getElementsByClassName("bbb  ccc ")` would return the same thing. A call to `getElementsByClassName("aaa,bbb")` would return no nodes; none of the elements above are in the `aaa,bbb` class. ---- +___ [Document/createElement](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement "In an HTML document, the document.createElement() method creates the HTML element specified by tagName, or an HTMLUnknownElement if tagName isn't recognized.") @@ -5512,15 +5909,15 @@ In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera6+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -5532,21 +5929,21 @@ If localName does not match the `[Name](https://www.w3.org/TR/xml/#NT-Name)` pro When supplied, options’s `[is](https://dom.spec.whatwg.org/#dom-elementcreationoptions-is)` can be used to create a [customized built-in element](https://html.spec.whatwg.org/multipage/custom-elements.html#customized-built-in-element). -[Document/createElementNS](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS 'Creates an element with the specified namespace URI and qualified name.') +[Document/createElementNS](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS "Creates an element with the specified namespace URI and qualified name.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -5565,113 +5962,113 @@ If one of the following conditions is true a "`[NamespaceError](https://webidl.s When supplied, options’s `[is](https://dom.spec.whatwg.org/#dom-elementcreationoptions-is)` can be used to create a [customized built-in element](https://html.spec.whatwg.org/multipage/custom-elements.html#customized-built-in-element). -[Document/createDocumentFragment](https://developer.mozilla.org/en-US/docs/Web/API/Document/createDocumentFragment 'Creates a new empty DocumentFragment into which DOM nodes can be added to build an offscreen DOM tree.') +[Document/createDocumentFragment](https://developer.mozilla.org/en-US/docs/Web/API/Document/createDocumentFragment "Creates a new empty DocumentFragment into which DOM nodes can be added to build an offscreen DOM tree.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` documentFragment = document . `[createDocumentFragment()](https://dom.spec.whatwg.org/#dom-document-createdocumentfragment)` `` +``documentFragment = document . `[createDocumentFragment()](https://dom.spec.whatwg.org/#dom-document-createdocumentfragment)` `` Returns a `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node). -[Document/createTextNode](https://developer.mozilla.org/en-US/docs/Web/API/Document/createTextNode 'Creates a new Text node. This method can be used to escape HTML characters.') +[Document/createTextNode](https://developer.mozilla.org/en-US/docs/Web/API/Document/createTextNode "Creates a new Text node. This method can be used to escape HTML characters.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ -`` text = document . `[createTextNode(data)](https://dom.spec.whatwg.org/#dom-document-createtextnode)` `` +``text = document . `[createTextNode(data)](https://dom.spec.whatwg.org/#dom-document-createtextnode)` `` Returns a `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node) whose [data](https://dom.spec.whatwg.org/#concept-cd-data) is data. -`` text = document . `[createCDATASection(data)](https://dom.spec.whatwg.org/#dom-document-createcdatasection)` `` +``text = document . `[createCDATASection(data)](https://dom.spec.whatwg.org/#dom-document-createcdatasection)` `` Returns a `[CDATASection](https://dom.spec.whatwg.org/#cdatasection)` [node](https://dom.spec.whatwg.org/#concept-node) whose [data](https://dom.spec.whatwg.org/#concept-cd-data) is data. -[Document/createCDATASection](https://developer.mozilla.org/en-US/docs/Web/API/Document/createCDATASection 'createCDATASection() creates a new CDATA section node, and returns it.') +[Document/createCDATASection](https://developer.mozilla.org/en-US/docs/Web/API/Document/createCDATASection "createCDATASection() creates a new CDATA section node, and returns it.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -[Document/createComment](https://developer.mozilla.org/en-US/docs/Web/API/Document/createComment 'createComment() creates a new comment node, and returns it.') +[Document/createComment](https://developer.mozilla.org/en-US/docs/Web/API/Document/createComment "createComment() creates a new comment node, and returns it.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` comment = document . `[createComment(data)](https://dom.spec.whatwg.org/#dom-document-createcomment)` `` +``comment = document . `[createComment(data)](https://dom.spec.whatwg.org/#dom-document-createcomment)` `` Returns a `[Comment](https://dom.spec.whatwg.org/#comment)` [node](https://dom.spec.whatwg.org/#concept-node) whose [data](https://dom.spec.whatwg.org/#concept-cd-data) is data. -[Document/createProcessingInstruction](https://developer.mozilla.org/en-US/docs/Web/API/Document/createProcessingInstruction 'createProcessingInstruction() generates a new processing instruction node and returns it.') +[Document/createProcessingInstruction](https://developer.mozilla.org/en-US/docs/Web/API/Document/createProcessingInstruction "createProcessingInstruction() generates a new processing instruction node and returns it.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` processingInstruction = document . `[createProcessingInstruction(target, data)](https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction)` `` +``processingInstruction = document . `[createProcessingInstruction(target, data)](https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction)` `` Returns a `[ProcessingInstruction](https://dom.spec.whatwg.org/#processinginstruction)` [node](https://dom.spec.whatwg.org/#concept-node) whose [target](https://dom.spec.whatwg.org/#concept-pi-target) is target and [data](https://dom.spec.whatwg.org/#concept-cd-data) is data. If target does not match the `[Name](https://www.w3.org/TR/xml/#NT-Name)` production an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` will be thrown. If data contains "`?>`" an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` will be thrown. @@ -5682,18 +6079,28 @@ The HTML Standard will, e.g., define that for `html` and the [HTML namespace](ht The `createElement(localName, options)` method steps are: 1. If localName does not match the `[Name](https://www.w3.org/TR/xml/#NT-Name)` production, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. If [this](https://webidl.spec.whatwg.org/#this) is an [HTML document](https://dom.spec.whatwg.org/#html-document), then set localName to localName in [ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase). + 3. Let is be null. + 4. If options is a [dictionary](https://webidl.spec.whatwg.org/#dfn-dictionary) and options\["`[is](https://dom.spec.whatwg.org/#dom-elementcreationoptions-is)`"\] [exists](https://infra.spec.whatwg.org/#map-exists), then set is to it. + 5. Let namespace be the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), if [this](https://webidl.spec.whatwg.org/#this) is an [HTML document](https://dom.spec.whatwg.org/#html-document) or [this](https://webidl.spec.whatwg.org/#this)’s [content type](https://dom.spec.whatwg.org/#concept-document-content-type) is "`application/xhtml+xml`"; otherwise null. + 6. Return the result of [creating an element](https://dom.spec.whatwg.org/#concept-create-element) given [this](https://webidl.spec.whatwg.org/#this), localName, namespace, null, is, and with the synchronous custom elements flag set. + The internal `createElementNS` steps, given document, namespace, qualifiedName, and options, are as follows: 1. Let namespace, prefix, and localName be the result of passing namespace and qualifiedName to [validate and extract](https://dom.spec.whatwg.org/#validate-and-extract). + 2. Let is be null. + 3. If options is a [dictionary](https://webidl.spec.whatwg.org/#dfn-dictionary) and options\["`[is](https://dom.spec.whatwg.org/#dom-elementcreationoptions-is)`"\] [exists](https://infra.spec.whatwg.org/#map-exists), then set is to it. + 4. Return the result of [creating an element](https://dom.spec.whatwg.org/#concept-create-element) given document, localName, namespace, prefix, is, and with the synchronous custom elements flag set. + The `createElementNS(namespace, qualifiedName, options)` method steps are to return the result of running the [internal `createElementNS` steps](https://dom.spec.whatwg.org/#internal-createelementns-steps), given [this](https://webidl.spec.whatwg.org/#this), namespace, qualifiedName, and options. @@ -5708,8 +6115,11 @@ No check is performed that data consists of characters that match the `[Char](ht The `createCDATASection(data)` method steps are: 1. If [this](https://webidl.spec.whatwg.org/#this) is an [HTML document](https://dom.spec.whatwg.org/#html-document), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. If data contains the string "`]]>`", then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 3. Return a new `[CDATASection](https://dom.spec.whatwg.org/#cdatasection)` [node](https://dom.spec.whatwg.org/#concept-node) with its [data](https://dom.spec.whatwg.org/#concept-cd-data) set to data and [node document](https://dom.spec.whatwg.org/#concept-node-document) set to [this](https://webidl.spec.whatwg.org/#this). + The method steps are to return a new `[Comment](https://dom.spec.whatwg.org/#comment)` [node](https://dom.spec.whatwg.org/#concept-node) whose [data](https://dom.spec.whatwg.org/#concept-cd-data) is data and [node document](https://dom.spec.whatwg.org/#concept-node-document) is [this](https://webidl.spec.whatwg.org/#this). @@ -5723,7 +6133,7 @@ The `createProcessingInstruction(target, data)` method steps are: No check is performed that target contains "`xml`" or "`:`", or that data contains characters that match the `[Char](https://www.w3.org/TR/xml/#NT-Char)` production. ---- +___ [Document/importNode](https://developer.mozilla.org/en-US/docs/Web/API/Document/importNode "The Document object's importNode() method creates a copy of a Node or DocumentFragment from another document, to be inserted into the current document later.") @@ -5731,15 +6141,15 @@ In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -5755,15 +6165,15 @@ In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -5776,229 +6186,252 @@ If node is a [document](https://dom.spec.whatwg.org/#concept-document), throws a The `importNode(node, deep)` method steps are: 1. If node is a [document](https://dom.spec.whatwg.org/#concept-document) or [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. Return a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of node, with [this](https://webidl.spec.whatwg.org/#this) and the _clone children flag_ set if deep is true. + [Specifications](https://dom.spec.whatwg.org/#other-applicable-specifications) may define adopting steps for all or some [nodes](https://dom.spec.whatwg.org/#concept-node). The algorithm is passed node and oldDocument, as indicated in the [adopt](https://dom.spec.whatwg.org/#concept-node-adopt) algorithm. To adopt a node into a document, run these steps: 1. Let oldDocument be node’s [node document](https://dom.spec.whatwg.org/#concept-node-document). + 2. If node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is non-null, then [remove](https://dom.spec.whatwg.org/#concept-node-remove) node. + 3. If document is not oldDocument, then: - + 1. For each inclusiveDescendant in node’s [shadow-including inclusive descendants](https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-descendant): - + 1. Set inclusiveDescendant’s [node document](https://dom.spec.whatwg.org/#concept-node-document) to document. + 2. If inclusiveDescendant is an [element](https://dom.spec.whatwg.org/#concept-element), then set the [node document](https://dom.spec.whatwg.org/#concept-node-document) of each [attribute](https://dom.spec.whatwg.org/#concept-attribute) in inclusiveDescendant’s [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute) to document. - + 2. For each inclusiveDescendant in node’s [shadow-including inclusive descendants](https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-descendant) that is [custom](https://dom.spec.whatwg.org/#concept-element-custom), [enqueue a custom element callback reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction) with inclusiveDescendant, callback name "`adoptedCallback`", and an argument list containing oldDocument and document. + 3. For each inclusiveDescendant in node’s [shadow-including inclusive descendants](https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-descendant), in [shadow-including tree order](https://dom.spec.whatwg.org/#concept-shadow-including-tree-order), run the [adopting steps](https://dom.spec.whatwg.org/#concept-node-adopt-ext) with inclusiveDescendant and oldDocument. + The `adoptNode(node)` method steps are: 1. If node is a [document](https://dom.spec.whatwg.org/#concept-document), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. If node is a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 3. If node is a `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node) whose [host](https://dom.spec.whatwg.org/#concept-documentfragment-host) is non-null, then return. + 4. [Adopt](https://dom.spec.whatwg.org/#concept-node-adopt) node into [this](https://webidl.spec.whatwg.org/#this). + 5. Return node. + ---- +___ -[Document/createAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Document/createAttribute 'The Document.createAttribute() method creates a new attribute node, and returns it. The object created a node implementing the Attr interface. The DOM does not enforce what sort of attributes can be added to a particular element in this manner.') +[Document/createAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Document/createAttribute "The Document.createAttribute() method creates a new attribute node, and returns it. The object created a node implementing the Attr interface. The DOM does not enforce what sort of attributes can be added to a particular element in this manner.") In all current engines. Firefox44+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android44+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `createAttribute(localName)` method steps are: 1. If localName does not match the `[Name](https://www.w3.org/TR/xml/#NT-Name)` production in XML, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. If [this](https://webidl.spec.whatwg.org/#this) is an [HTML document](https://dom.spec.whatwg.org/#html-document), then set localName to localName in [ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase). 3. Return a new [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) is localName and [node document](https://dom.spec.whatwg.org/#concept-node-document) is [this](https://webidl.spec.whatwg.org/#this). The `createAttributeNS(namespace, qualifiedName)` method steps are: 1. Let namespace, prefix, and localName be the result of passing namespace and qualifiedName to [validate and extract](https://dom.spec.whatwg.org/#validate-and-extract). + 2. Return a new [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace) is namespace, [namespace prefix](https://dom.spec.whatwg.org/#concept-attribute-namespace-prefix) is prefix, [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) is localName, and [node document](https://dom.spec.whatwg.org/#concept-node-document) is [this](https://webidl.spec.whatwg.org/#this). + ---- +___ -[Document/createEvent](https://developer.mozilla.org/en-US/docs/Web/API/Document/createEvent 'Creates an event of the type specified. The returned object should be first initialized and can then be passed to EventTarget.dispatchEvent.') +[Document/createEvent](https://developer.mozilla.org/en-US/docs/Web/API/Document/createEvent "Creates an event of the type specified. The returned object should be first initialized and can then be passed to EventTarget.dispatchEvent.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera7+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `createEvent(interface)` method steps are: 1. Let constructor be null. + 2. If interface is an [ASCII case-insensitive](https://infra.spec.whatwg.org/#ascii-case-insensitive) match for any of the strings in the first column in the following table, then set constructor to the interface in the second column on the same row as the matching string: - + String - + Interface - + Notes - + "`beforeunloadevent`" - + `[BeforeUnloadEvent](https://html.spec.whatwg.org/multipage/browsing-the-web.html#beforeunloadevent)` - + [\[HTML\]](https://dom.spec.whatwg.org/#biblio-html) - + "`compositionevent`" - + `[CompositionEvent](https://www.w3.org/TR/uievents/#compositionevent)` - + [\[UIEVENTS\]](https://dom.spec.whatwg.org/#biblio-uievents) - + "`customevent`" - + `[CustomEvent](https://dom.spec.whatwg.org/#customevent)` - + "`devicemotionevent`" - + `[DeviceMotionEvent](https://w3c.github.io/deviceorientation/spec-source-orientation.html#devicemotion)` - + [\[DEVICE-ORIENTATION\]](https://dom.spec.whatwg.org/#biblio-device-orientation) - + "`deviceorientationevent`" - + `[DeviceOrientationEvent](https://w3c.github.io/deviceorientation/spec-source-orientation.html#devicemotion)` - + "`dragevent`" - + `[DragEvent](https://html.spec.whatwg.org/multipage/dnd.html#dragevent)` - + [\[HTML\]](https://dom.spec.whatwg.org/#biblio-html) - + "`event`" - + `[Event](https://dom.spec.whatwg.org/#event)` - + "`events`" - + "`focusevent`" - + `[FocusEvent](https://www.w3.org/TR/uievents/#focusevent)` - + [\[UIEVENTS\]](https://dom.spec.whatwg.org/#biblio-uievents) - + "`hashchangeevent`" - + `[HashChangeEvent](https://html.spec.whatwg.org/multipage/browsing-the-web.html#hashchangeevent)` - + [\[HTML\]](https://dom.spec.whatwg.org/#biblio-html) - + "`htmlevents`" - + `[Event](https://dom.spec.whatwg.org/#event)` - + "`keyboardevent`" - + `[KeyboardEvent](https://www.w3.org/TR/uievents/#keyboardevent)` - + [\[UIEVENTS\]](https://dom.spec.whatwg.org/#biblio-uievents) - + "`messageevent`" - + `[MessageEvent](https://html.spec.whatwg.org/multipage/comms.html#messageevent)` - + [\[HTML\]](https://dom.spec.whatwg.org/#biblio-html) - + "`mouseevent`" - + `[MouseEvent](https://www.w3.org/TR/uievents/#mouseevent)` - + [\[UIEVENTS\]](https://dom.spec.whatwg.org/#biblio-uievents) - + "`mouseevents`" - + "`storageevent`" - + `[StorageEvent](https://html.spec.whatwg.org/multipage/webstorage.html#storageevent)` - + [\[HTML\]](https://dom.spec.whatwg.org/#biblio-html) - + "`svgevents`" - + `[Event](https://dom.spec.whatwg.org/#event)` - + "`textevent`" - + `[CompositionEvent](https://www.w3.org/TR/uievents/#compositionevent)` - + [\[UIEVENTS\]](https://dom.spec.whatwg.org/#biblio-uievents) - + "`touchevent`" - + `[TouchEvent](https://w3c.github.io/touch-events/#idl-def-touchevent)` - + [\[TOUCH-EVENTS\]](https://dom.spec.whatwg.org/#biblio-touch-events) - + "`uievent`" - + `[UIEvent](https://www.w3.org/TR/uievents/#uievent)` - + [\[UIEVENTS\]](https://dom.spec.whatwg.org/#biblio-uievents) - + "`uievents`" - + 3. If constructor is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 4. If the interface indicated by constructor is not exposed on the [relevant global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global) of [this](https://webidl.spec.whatwg.org/#this), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. - + Typically user agents disable support for touch events in some configurations, in which case this clause would be triggered for the interface `[TouchEvent](https://w3c.github.io/touch-events/#idl-def-touchevent)`. - + 5. Let event be the result of [creating an event](https://dom.spec.whatwg.org/#concept-event-create) given constructor. + 6. Initialize event’s `[type](https://dom.spec.whatwg.org/#dom-event-type)` attribute to the empty string. + 7. Initialize event’s `[timeStamp](https://dom.spec.whatwg.org/#dom-event-timestamp)` attribute to the result of calling [current high resolution time](https://w3c.github.io/hr-time/#dfn-current-high-resolution-time) with [this](https://webidl.spec.whatwg.org/#this)’s [relevant global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global). + 8. Initialize event’s `[isTrusted](https://dom.spec.whatwg.org/#dom-event-istrusted)` attribute to false. + 9. Unset event’s [initialized flag](https://dom.spec.whatwg.org/#initialized-flag). -10. Return event. + +10. Return event. + [Event](https://dom.spec.whatwg.org/#concept-event) constructors ought to be used instead. ---- +___ -[Document/createRange](https://developer.mozilla.org/en-US/docs/Web/API/Document/createRange 'The Document.createRange() method returns a new Range object.') +[Document/createRange](https://developer.mozilla.org/en-US/docs/Web/API/Document/createRange "The Document.createRange() method returns a new Range object.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -6006,78 +6439,88 @@ The `createRange()` method steps are to return a new [live range](https://dom.sp The `[Range()](https://dom.spec.whatwg.org/#dom-range-range)` constructor can be used instead. ---- +___ -[Document/createNodeIterator](https://developer.mozilla.org/en-US/docs/Web/API/Document/createNodeIterator 'Returns a new NodeIterator object.') +[Document/createNodeIterator](https://developer.mozilla.org/en-US/docs/Web/API/Document/createNodeIterator "Returns a new NodeIterator object.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera MobileYes The `createNodeIterator(root, whatToShow, filter)` method steps are: 1. Let iterator be a new `[NodeIterator](https://dom.spec.whatwg.org/#nodeiterator)` object. + 2. Set iterator’s [root](https://dom.spec.whatwg.org/#concept-traversal-root) and iterator’s [reference](https://dom.spec.whatwg.org/#nodeiterator-reference) to root. + 3. Set iterator’s [pointer before reference](https://dom.spec.whatwg.org/#nodeiterator-pointer-before-reference) to true. + 4. Set iterator’s [whatToShow](https://dom.spec.whatwg.org/#concept-traversal-whattoshow) to whatToShow. + 5. Set iterator’s [filter](https://dom.spec.whatwg.org/#concept-traversal-filter) to filter. + 6. Return iterator. + -[Document/createTreeWalker](https://developer.mozilla.org/en-US/docs/Web/API/Document/createTreeWalker 'The Document.createTreeWalker() creator method returns a newly created TreeWalker object.') +[Document/createTreeWalker](https://developer.mozilla.org/en-US/docs/Web/API/Document/createTreeWalker "The Document.createTreeWalker() creator method returns a newly created TreeWalker object.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `createTreeWalker(root, whatToShow, filter)` method steps are: 1. Let walker be a new `[TreeWalker](https://dom.spec.whatwg.org/#treewalker)` object. + 2. Set walker’s [root](https://dom.spec.whatwg.org/#concept-traversal-root) and walker’s [current](https://dom.spec.whatwg.org/#treewalker-current) to root. + 3. Set walker’s [whatToShow](https://dom.spec.whatwg.org/#concept-traversal-whattoshow) to whatToShow. + 4. Set walker’s [filter](https://dom.spec.whatwg.org/#concept-traversal-filter) to filter. + 5. Return walker. #### 4.5.1. Interface `[DOMImplementation](https://dom.spec.whatwg.org/#domimplementation)`[](https://dom.spec.whatwg.org/#interface-domimplementation) -[DOMImplementation](https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation '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.') +[DOMImplementation](https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation "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.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -6085,127 +6528,145 @@ User agents must create a `[DOMImplementation](https://dom.spec.whatwg.org/#domi \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `DOMImplementation` { -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [DocumentType](https://dom.spec.whatwg.org/#documenttype) [createDocumentType](https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype-qualifiedname-publicid-systemid-qualifiedname), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `publicId`[](https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype-qualifiedname-publicid-systemid-publicid), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `systemId`[](https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype-qualifiedname-publicid-systemid-systemid)); -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [XMLDocument](https://dom.spec.whatwg.org/#xmldocument) [createDocument](https://dom.spec.whatwg.org/#dom-domimplementation-createdocument)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-domimplementation-createdocument-namespace-qualifiedname-doctype-namespace), \[[LegacyNullToEmptyString](https://webidl.spec.whatwg.org/#LegacyNullToEmptyString)\] [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-domimplementation-createdocument-namespace-qualifiedname-doctype-qualifiedname), optional [DocumentType](https://dom.spec.whatwg.org/#documenttype)? `doctype`[](https://dom.spec.whatwg.org/#dom-domimplementation-createdocument-namespace-qualifiedname-doctype-doctype) = null); -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Document](https://dom.spec.whatwg.org/#document) [createHTMLDocument](https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument)(optional [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `title`[](https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument-title-title)); + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [DocumentType](https://dom.spec.whatwg.org/#documenttype) [createDocumentType](https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype-qualifiedname-publicid-systemid-qualifiedname), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `publicId`[](https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype-qualifiedname-publicid-systemid-publicid), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `systemId`[](https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype-qualifiedname-publicid-systemid-systemid)); + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [XMLDocument](https://dom.spec.whatwg.org/#xmldocument) [createDocument](https://dom.spec.whatwg.org/#dom-domimplementation-createdocument)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-domimplementation-createdocument-namespace-qualifiedname-doctype-namespace), \[[LegacyNullToEmptyString](https://webidl.spec.whatwg.org/#LegacyNullToEmptyString)\] [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-domimplementation-createdocument-namespace-qualifiedname-doctype-qualifiedname), optional [DocumentType](https://dom.spec.whatwg.org/#documenttype)? `doctype`[](https://dom.spec.whatwg.org/#dom-domimplementation-createdocument-namespace-qualifiedname-doctype-doctype) = null); + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Document](https://dom.spec.whatwg.org/#document) [createHTMLDocument](https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument)(optional [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `title`[](https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument-title-title)); -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [hasFeature](https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature)(); // useless; always returns true + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [hasFeature](https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature)(); // useless; always returns true }; -[DOMImplementation/createDocumentType](https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType '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().') +[DOMImplementation/createDocumentType](https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType "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().") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` doctype = document . `[implementation](https://dom.spec.whatwg.org/#dom-document-implementation)` . `[createDocumentType(qualifiedName, publicId, systemId)](https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype)` `` +``doctype = document . `[implementation](https://dom.spec.whatwg.org/#dom-document-implementation)` . `[createDocumentType(qualifiedName, publicId, systemId)](https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype)` `` Returns a [doctype](https://dom.spec.whatwg.org/#concept-doctype), with the given qualifiedName, publicId, and systemId. If qualifiedName does not match the `[Name](https://www.w3.org/TR/xml/#NT-Name)` production, an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` is thrown, and if it does not match the `[QName](https://www.w3.org/TR/xml-names/#NT-QName)` production, a "`[NamespaceError](https://webidl.spec.whatwg.org/#namespaceerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` is thrown. -[DOMImplementation/createDocument](https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument 'The DOMImplementation.createDocument() method creates and returns an XMLDocument.') +[DOMImplementation/createDocument](https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument "The DOMImplementation.createDocument() method creates and returns an XMLDocument.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` doc = document . `[implementation](https://dom.spec.whatwg.org/#dom-document-implementation)` . [createDocument(namespace, qualifiedName [, doctype = null])](https://dom.spec.whatwg.org/#dom-domimplementation-createdocument) `` +``doc = document . `[implementation](https://dom.spec.whatwg.org/#dom-document-implementation)` . [createDocument(namespace, qualifiedName [, doctype = null])](https://dom.spec.whatwg.org/#dom-domimplementation-createdocument)`` Returns an `[XMLDocument](https://dom.spec.whatwg.org/#xmldocument)`, with a [document element](https://dom.spec.whatwg.org/#document-element) whose [local name](https://dom.spec.whatwg.org/#concept-element-local-name) is qualifiedName and whose [namespace](https://dom.spec.whatwg.org/#concept-element-namespace) is namespace (unless qualifiedName is the empty string), and with doctype, if it is given, as its [doctype](https://dom.spec.whatwg.org/#concept-doctype). This method throws the same exceptions as the `[createElementNS()](https://dom.spec.whatwg.org/#dom-document-createelementns)` method, when invoked with namespace and qualifiedName. -[DOMImplementation/createHTMLDocument](https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument 'The DOMImplementation.createHTMLDocument() method creates a new HTML Document.') +[DOMImplementation/createHTMLDocument](https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument "The DOMImplementation.createHTMLDocument() method creates a new HTML Document.") In all current engines. Firefox4+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -`` doc = document . `[implementation](https://dom.spec.whatwg.org/#dom-document-implementation)` . [createHTMLDocument([title])](https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument) `` +``doc = document . `[implementation](https://dom.spec.whatwg.org/#dom-document-implementation)` . [createHTMLDocument([title])](https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument)`` Returns a [document](https://dom.spec.whatwg.org/#concept-document), with a basic [tree](https://dom.spec.whatwg.org/#concept-tree) already constructed including a `[title](https://html.spec.whatwg.org/multipage/semantics.html#the-title-element)` element, unless the title argument is omitted. The `createDocumentType(qualifiedName, publicId, systemId)` method steps are: 1. [Validate](https://dom.spec.whatwg.org/#validate) qualifiedName. + 2. Return a new [doctype](https://dom.spec.whatwg.org/#concept-doctype), with qualifiedName as its [name](https://dom.spec.whatwg.org/#concept-doctype-name), publicId as its [public ID](https://dom.spec.whatwg.org/#concept-doctype-publicid), and systemId as its [system ID](https://dom.spec.whatwg.org/#concept-doctype-systemid), and with its [node document](https://dom.spec.whatwg.org/#concept-node-document) set to the associated [document](https://dom.spec.whatwg.org/#concept-document) of [this](https://webidl.spec.whatwg.org/#this). + No check is performed that publicId code points match the `[PubidChar](https://www.w3.org/TR/xml/#NT-PubidChar)` production or that systemId does not contain both a '`"`' and a "`'`". The `createDocument(namespace, qualifiedName, doctype)` method steps are: 1. Let document be a new `[XMLDocument](https://dom.spec.whatwg.org/#xmldocument)`. + 2. Let element be null. + 3. If qualifiedName is not the empty string, then set element to the result of running the [internal `createElementNS` steps](https://dom.spec.whatwg.org/#internal-createelementns-steps), given document, namespace, qualifiedName, and an empty dictionary. + 4. If doctype is non-null, [append](https://dom.spec.whatwg.org/#concept-node-append) doctype to document. + 5. If element is non-null, [append](https://dom.spec.whatwg.org/#concept-node-append) element to document. + 6. document’s [origin](https://dom.spec.whatwg.org/#concept-document-origin) is [this](https://webidl.spec.whatwg.org/#this)’s associated [document](https://dom.spec.whatwg.org/#concept-document)’s [origin](https://dom.spec.whatwg.org/#concept-document-origin). + 7. document’s [content type](https://dom.spec.whatwg.org/#concept-document-content-type) is determined by namespace: - + [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) - + `application/xhtml+xml` - + [SVG namespace](https://infra.spec.whatwg.org/#svg-namespace) - + `image/svg+xml` - + Any other namespace - + `application/xml` - + 8. Return document. + The `createHTMLDocument(title)` method steps are: 1. Let doc be a new [document](https://dom.spec.whatwg.org/#concept-document) that is an [HTML document](https://dom.spec.whatwg.org/#html-document). + 2. Set doc’s [content type](https://dom.spec.whatwg.org/#concept-document-content-type) to "`text/html`". + 3. [Append](https://dom.spec.whatwg.org/#concept-node-append) a new [doctype](https://dom.spec.whatwg.org/#concept-doctype), with "`html`" as its [name](https://dom.spec.whatwg.org/#concept-doctype-name) and with its [node document](https://dom.spec.whatwg.org/#concept-node-document) set to doc, to doc. + 4. [Append](https://dom.spec.whatwg.org/#concept-node-append) the result of [creating an element](https://dom.spec.whatwg.org/#concept-create-element) given doc, `[html](https://html.spec.whatwg.org/multipage/semantics.html#the-html-element)`, and the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), to doc. + 5. [Append](https://dom.spec.whatwg.org/#concept-node-append) the result of [creating an element](https://dom.spec.whatwg.org/#concept-create-element) given doc, `[head](https://html.spec.whatwg.org/multipage/semantics.html#the-head-element)`, and the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), to the `[html](https://html.spec.whatwg.org/multipage/semantics.html#the-html-element)` element created earlier. + 6. If title is given: - + 1. [Append](https://dom.spec.whatwg.org/#concept-node-append) the result of [creating an element](https://dom.spec.whatwg.org/#concept-create-element) given doc, `[title](https://html.spec.whatwg.org/multipage/semantics.html#the-title-element)`, and the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), to the `[head](https://html.spec.whatwg.org/multipage/semantics.html#the-head-element)` element created earlier. + 2. [Append](https://dom.spec.whatwg.org/#concept-node-append) a new `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node), with its [data](https://dom.spec.whatwg.org/#concept-cd-data) set to title (which could be the empty string) and its [node document](https://dom.spec.whatwg.org/#concept-node-document) set to doc, to the `[title](https://html.spec.whatwg.org/multipage/semantics.html#the-title-element)` element created earlier. - + 7. [Append](https://dom.spec.whatwg.org/#concept-node-append) the result of [creating an element](https://dom.spec.whatwg.org/#concept-create-element) given doc, `[body](https://html.spec.whatwg.org/multipage/sections.html#the-body-element)`, and the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), to the `[html](https://html.spec.whatwg.org/multipage/semantics.html#the-html-element)` element created earlier. + 8. doc’s [origin](https://dom.spec.whatwg.org/#concept-document-origin) is [this](https://webidl.spec.whatwg.org/#this)’s associated [document](https://dom.spec.whatwg.org/#concept-document)’s [origin](https://dom.spec.whatwg.org/#concept-document-origin). + 9. Return doc. + The `hasFeature()` method steps are to return true. @@ -6213,29 +6674,29 @@ The `hasFeature()` method steps are to return true. ### 4.6. Interface `[DocumentType](https://dom.spec.whatwg.org/#documenttype)`[](https://dom.spec.whatwg.org/#interface-documenttype) -[DocumentType](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType 'The DocumentType interface represents a Node containing a doctype.') +[DocumentType](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType "The DocumentType interface represents a Node containing a doctype.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `DocumentType` : [Node](https://dom.spec.whatwg.org/#node) { -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [name](https://dom.spec.whatwg.org/#dom-documenttype-name); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [publicId](https://dom.spec.whatwg.org/#dom-documenttype-publicid); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [systemId](https://dom.spec.whatwg.org/#dom-documenttype-systemid); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [name](https://dom.spec.whatwg.org/#dom-documenttype-name); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [publicId](https://dom.spec.whatwg.org/#dom-documenttype-publicid); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [systemId](https://dom.spec.whatwg.org/#dom-documenttype-systemid); }; `[DocumentType](https://dom.spec.whatwg.org/#documenttype)` [nodes](https://dom.spec.whatwg.org/#concept-node) are simply known as doctypes. @@ -6252,27 +6713,27 @@ The `systemId` getter steps are to return [this](https://webidl.spec.whatwg.org/ ### 4.7. Interface `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)`[](https://dom.spec.whatwg.org/#interface-documentfragment) -[DocumentFragment](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment 'The DocumentFragment interface represents a minimal document object that has no parent.') +[DocumentFragment](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment "The DocumentFragment interface represents a minimal document object that has no parent.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera8+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `DocumentFragment` : [Node](https://dom.spec.whatwg.org/#node) { -[constructor](https://dom.spec.whatwg.org/#dom-documentfragment-documentfragment)(); + [constructor](https://dom.spec.whatwg.org/#dom-documentfragment-documentfragment)(); }; A `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node) has an associated host (null or an [element](https://dom.spec.whatwg.org/#concept-element) in a different [node tree](https://dom.spec.whatwg.org/#concept-node-tree)). It is null unless otherwise stated. @@ -6281,25 +6742,25 @@ An object A is a host-including inclusive ancestor of an object B, if either A i The `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node)’s [host](https://dom.spec.whatwg.org/#concept-documentfragment-host) concept is useful for HTML’s `[template](https://html.spec.whatwg.org/multipage/scripting.html#the-template-element)` element and for [shadow roots](https://dom.spec.whatwg.org/#concept-shadow-root), and impacts the [pre-insert](https://dom.spec.whatwg.org/#concept-node-pre-insert) and [replace](https://dom.spec.whatwg.org/#concept-node-replace) algorithms. -[DocumentFragment/DocumentFragment](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/DocumentFragment 'The DocumentFragment() constructor returns a new, empty DocumentFragment object .') +[DocumentFragment/DocumentFragment](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/DocumentFragment "The DocumentFragment() constructor returns a new, empty DocumentFragment object .") In all current engines. Firefox24+Safari8+Chrome29+ ---- +___ Opera16+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android24+iOS Safari8+Chrome for Android29+Android WebView37+Samsung Internet2.0+Opera Mobile16+ -`` tree = new `[DocumentFragment()](https://dom.spec.whatwg.org/#dom-documentfragment-documentfragment)` `` +``tree = new `[DocumentFragment()](https://dom.spec.whatwg.org/#dom-documentfragment-documentfragment)` `` Returns a new `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node). @@ -6313,25 +6774,25 @@ In all current engines. Firefox63+Safari10.1+Chrome53+ ---- +___ Opera40+Edge79+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android63+iOS Safari10.3+Chrome for Android53+Android WebView53+Samsung Internet6.0+Opera Mobile41+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `ShadowRoot` : [DocumentFragment](https://dom.spec.whatwg.org/#documentfragment) { -readonly attribute [ShadowRootMode](https://dom.spec.whatwg.org/#enumdef-shadowrootmode) [mode](https://dom.spec.whatwg.org/#dom-shadowroot-mode); -readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [delegatesFocus](https://dom.spec.whatwg.org/#dom-shadowroot-delegatesfocus); -readonly attribute [SlotAssignmentMode](https://dom.spec.whatwg.org/#enumdef-slotassignmentmode) [slotAssignment](https://dom.spec.whatwg.org/#dom-shadowroot-slotassignment); -readonly attribute [Element](https://dom.spec.whatwg.org/#element) [host](https://dom.spec.whatwg.org/#dom-shadowroot-host); -attribute [EventHandler](https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler) [onslotchange](https://dom.spec.whatwg.org/#dom-shadowroot-onslotchange); + readonly attribute [ShadowRootMode](https://dom.spec.whatwg.org/#enumdef-shadowrootmode) [mode](https://dom.spec.whatwg.org/#dom-shadowroot-mode); + readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [delegatesFocus](https://dom.spec.whatwg.org/#dom-shadowroot-delegatesfocus); + readonly attribute [SlotAssignmentMode](https://dom.spec.whatwg.org/#enumdef-slotassignmentmode) [slotAssignment](https://dom.spec.whatwg.org/#dom-shadowroot-slotassignment); + readonly attribute [Element](https://dom.spec.whatwg.org/#element) [host](https://dom.spec.whatwg.org/#dom-shadowroot-host); + attribute [EventHandler](https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler) [onslotchange](https://dom.spec.whatwg.org/#dom-shadowroot-onslotchange); }; enum `ShadowRootMode` { `"open"`[](https://dom.spec.whatwg.org/#dom-shadowrootmode-open), `"closed"`[](https://dom.spec.whatwg.org/#dom-shadowrootmode-closed) }; @@ -6341,21 +6802,21 @@ enum `SlotAssignmentMode` { `"manual"`[](https://dom.spec.whatwg.org/#dom-slotas [Shadow roots](https://dom.spec.whatwg.org/#concept-shadow-root) have an associated mode ("`open`" or "`closed`"). -[ShadowRoot/delegatesFocus](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/delegatesFocus 'The delegatesFocus read-only property of the ShadowRoot interface returns true if the shadow root delegates focus, and false otherwise.') +[ShadowRoot/delegatesFocus](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/delegatesFocus "The delegatesFocus read-only property of the ShadowRoot interface returns true if the shadow root delegates focus, and false otherwise.") In all current engines. Firefox94+Safari15+Chrome53+ ---- +___ Opera40+Edge79+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android94+iOS Safari15+Chrome for Android53+Android WebView53+Samsung Internet6.0+Opera Mobile41+ @@ -6375,15 +6836,15 @@ In all current engines. Firefox63+Safari10.1+Chrome53+ ---- +___ Opera40+Edge79+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android63+iOS Safari10.3+Chrome for Android53+Android WebView53+Samsung Internet6.0+Opera Mobile41+ @@ -6393,21 +6854,21 @@ The `delegatesFocus` getter steps are to return [this](https://webidl.spec.whatw The `slotAssignment` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [slot assignment](https://dom.spec.whatwg.org/#shadowroot-slot-assignment). -[ShadowRoot/host](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/host 'The host read-only property of the ShadowRoot returns a reference to the DOM element the ShadowRoot is attached to.') +[ShadowRoot/host](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/host "The host read-only property of the ShadowRoot returns a reference to the DOM element the ShadowRoot is attached to.") In all current engines. Firefox63+Safari10.1+Chrome53+ ---- +___ Opera40+Edge79+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android63+iOS Safari10.3+Chrome for Android53+Android WebView53+Samsung Internet6.0+Opera Mobile41+ @@ -6415,7 +6876,7 @@ The `host` getter steps are to return [this](https://webidl.spec.whatwg.org/#thi The `onslotchange` attribute is an [event handler IDL attribute](https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-idl-attributes) for the `onslotchange`[](https://dom.spec.whatwg.org/#shadowroot-onslotchange) [event handler](https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers), whose [event handler event type](https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type) is `[slotchange](https://html.spec.whatwg.org/multipage/indices.html#event-slotchange)`. ---- +___ In shadow-including tree order is [shadow-including preorder, depth-first traversal](https://dom.spec.whatwg.org/#shadow-including-preorder-depth-first-traversal) of a [node tree](https://dom.spec.whatwg.org/#concept-node-tree). Shadow-including preorder, depth-first traversal of a [node tree](https://dom.spec.whatwg.org/#concept-node-tree) tree is preorder, depth-first traversal of tree, with for each [shadow host](https://dom.spec.whatwg.org/#element-shadow-host) encountered in tree, [shadow-including preorder, depth-first traversal](https://dom.spec.whatwg.org/#shadow-including-preorder-depth-first-traversal) of that [element](https://dom.spec.whatwg.org/#concept-element)’s [shadow root](https://dom.spec.whatwg.org/#concept-element-shadow-root)’s [node tree](https://dom.spec.whatwg.org/#concept-node-tree) just after it is encountered. @@ -6432,93 +6893,97 @@ A shadow-including inclusive ancestor is an object or one of its [shadow-includi A [node](https://dom.spec.whatwg.org/#concept-node) A is closed-shadow-hidden from a [node](https://dom.spec.whatwg.org/#concept-node) B if all of the following conditions are true: - A’s [root](https://dom.spec.whatwg.org/#concept-tree-root) is a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root). + - A’s [root](https://dom.spec.whatwg.org/#concept-tree-root) is not a [shadow-including inclusive ancestor](https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-ancestor) of B. + - A’s [root](https://dom.spec.whatwg.org/#concept-tree-root) is a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root) whose [mode](https://dom.spec.whatwg.org/#shadowroot-mode) is "`closed`" or A’s [root](https://dom.spec.whatwg.org/#concept-tree-root)’s [host](https://dom.spec.whatwg.org/#concept-documentfragment-host) is [closed-shadow-hidden](https://dom.spec.whatwg.org/#concept-closed-shadow-hidden) from B. + To retarget an object A against an object B, repeat these steps until they return an object: 1. If one of the following is true - + - A is not a [node](https://dom.spec.whatwg.org/#concept-node) - A’s [root](https://dom.spec.whatwg.org/#concept-tree-root) is not a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root) - B is a [node](https://dom.spec.whatwg.org/#concept-node) and A’s [root](https://dom.spec.whatwg.org/#concept-tree-root) is a [shadow-including inclusive ancestor](https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-ancestor) of B - + then return A. - + 2. Set A to A’s [root](https://dom.spec.whatwg.org/#concept-tree-root)’s [host](https://dom.spec.whatwg.org/#concept-documentfragment-host). + The [retargeting](https://dom.spec.whatwg.org/#retarget) algorithm is used by [event dispatch](https://dom.spec.whatwg.org/#concept-event-dispatch) as well as other specifications, such as Fullscreen. [\[FULLSCREEN\]](https://dom.spec.whatwg.org/#biblio-fullscreen) ### 4.9. Interface `[Element](https://dom.spec.whatwg.org/#element)`[](https://dom.spec.whatwg.org/#interface-element) -[Element](https://developer.mozilla.org/en-US/docs/Web/API/Element '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.') +[Element](https://developer.mozilla.org/en-US/docs/Web/API/Element "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.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera8+Edge79+ ---- +___ Edge (Legacy)12+IE4+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `Element` : [Node](https://dom.spec.whatwg.org/#node) { -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [namespaceURI](https://dom.spec.whatwg.org/#dom-element-namespaceuri); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [prefix](https://dom.spec.whatwg.org/#dom-element-prefix); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [localName](https://dom.spec.whatwg.org/#dom-element-localname); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [tagName](https://dom.spec.whatwg.org/#dom-element-tagname); - -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [id](https://dom.spec.whatwg.org/#dom-element-id); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [className](https://dom.spec.whatwg.org/#dom-element-classname); -\[[SameObject](https://webidl.spec.whatwg.org/#SameObject), [PutForwards](https://webidl.spec.whatwg.org/#PutForwards)\=[value](https://dom.spec.whatwg.org/#dom-domtokenlist-value)\] readonly attribute [DOMTokenList](https://dom.spec.whatwg.org/#domtokenlist) [classList](https://dom.spec.whatwg.org/#dom-element-classlist); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [slot](https://dom.spec.whatwg.org/#dom-element-slot); - -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [hasAttributes](https://dom.spec.whatwg.org/#dom-element-hasattributes)(); -\[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [NamedNodeMap](https://dom.spec.whatwg.org/#namednodemap) [attributes](https://dom.spec.whatwg.org/#dom-element-attributes); -[sequence](https://webidl.spec.whatwg.org/#idl-sequence)<[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)\> [getAttributeNames](https://dom.spec.whatwg.org/#dom-element-getattributenames)(); -[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [getAttribute](https://dom.spec.whatwg.org/#dom-element-getattribute)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-getattribute-qualifiedname-qualifiedname)); -[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [getAttributeNS](https://dom.spec.whatwg.org/#dom-element-getattributens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-element-getattributens-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-element-getattributens-namespace-localname-localname)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setAttribute](https://dom.spec.whatwg.org/#dom-element-setattribute)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-setattribute-qualifiedname-value-qualifiedname), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `value`[](https://dom.spec.whatwg.org/#dom-element-setattribute-qualifiedname-value-value)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setAttributeNS](https://dom.spec.whatwg.org/#dom-element-setattributens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-element-setattributens-namespace-qualifiedname-value-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-setattributens-namespace-qualifiedname-value-qualifiedname), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `value`[](https://dom.spec.whatwg.org/#dom-element-setattributens-namespace-qualifiedname-value-value)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [removeAttribute](https://dom.spec.whatwg.org/#dom-element-removeattribute)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-removeattribute-qualifiedname-qualifiedname)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [removeAttributeNS](https://dom.spec.whatwg.org/#dom-element-removeattributens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-element-removeattributens-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-element-removeattributens-namespace-localname-localname)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [toggleAttribute](https://dom.spec.whatwg.org/#dom-element-toggleattribute)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-toggleattribute-qualifiedname-force-qualifiedname), optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `force`[](https://dom.spec.whatwg.org/#dom-element-toggleattribute-qualifiedname-force-force)); -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [hasAttribute](https://dom.spec.whatwg.org/#dom-element-hasattribute)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-hasattribute-qualifiedname-qualifiedname)); -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [hasAttributeNS](https://dom.spec.whatwg.org/#dom-element-hasattributens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-element-hasattributens-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-element-hasattributens-namespace-localname-localname)); - -[Attr](https://dom.spec.whatwg.org/#attr)? [getAttributeNode](https://dom.spec.whatwg.org/#dom-element-getattributenode)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-getattributenode-qualifiedname-qualifiedname)); -[Attr](https://dom.spec.whatwg.org/#attr)? [getAttributeNodeNS](https://dom.spec.whatwg.org/#dom-element-getattributenodens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-element-getattributenodens-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-element-getattributenodens-namespace-localname-localname)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Attr](https://dom.spec.whatwg.org/#attr)? [setAttributeNode](https://dom.spec.whatwg.org/#dom-element-setattributenode)([Attr](https://dom.spec.whatwg.org/#attr) `attr`[](https://dom.spec.whatwg.org/#dom-element-setattributenode-attr-attr)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Attr](https://dom.spec.whatwg.org/#attr)? [setAttributeNodeNS](https://dom.spec.whatwg.org/#dom-element-setattributenodens)([Attr](https://dom.spec.whatwg.org/#attr) `attr`[](https://dom.spec.whatwg.org/#dom-element-setattributenodens-attr-attr)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Attr](https://dom.spec.whatwg.org/#attr) [removeAttributeNode](https://dom.spec.whatwg.org/#dom-element-removeattributenode)([Attr](https://dom.spec.whatwg.org/#attr) `attr`[](https://dom.spec.whatwg.org/#dom-element-removeattributenode-attr-attr)); - -[ShadowRoot](https://dom.spec.whatwg.org/#shadowroot) [attachShadow](https://dom.spec.whatwg.org/#dom-element-attachshadow)([ShadowRootInit](https://dom.spec.whatwg.org/#dictdef-shadowrootinit) `init`[](https://dom.spec.whatwg.org/#dom-element-attachshadow-init-init)); -readonly attribute [ShadowRoot](https://dom.spec.whatwg.org/#shadowroot)? [shadowRoot](https://dom.spec.whatwg.org/#dom-element-shadowroot); - -[Element](https://dom.spec.whatwg.org/#element)? [closest](https://dom.spec.whatwg.org/#dom-element-closest)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `selectors`[](https://dom.spec.whatwg.org/#dom-element-closest-selectors-selectors)); -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [matches](https://dom.spec.whatwg.org/#dom-element-matches)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `selectors`[](https://dom.spec.whatwg.org/#dom-element-matches-selectors-selectors)); -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [webkitMatchesSelector](https://dom.spec.whatwg.org/#dom-element-webkitmatchesselector)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `selectors`[](https://dom.spec.whatwg.org/#dom-element-webkitmatchesselector-selectors-selectors)); // legacy alias of .matches - -[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection) [getElementsByTagName](https://dom.spec.whatwg.org/#dom-element-getelementsbytagname)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-getelementsbytagname-qualifiedname-qualifiedname)); -[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection) [getElementsByTagNameNS](https://dom.spec.whatwg.org/#dom-element-getelementsbytagnamens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-element-getelementsbytagnamens-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-element-getelementsbytagnamens-namespace-localname-localname)); -[HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection) [getElementsByClassName](https://dom.spec.whatwg.org/#dom-element-getelementsbyclassname)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `classNames`[](https://dom.spec.whatwg.org/#dom-element-getelementsbyclassname-classnames-classnames)); - -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Element](https://dom.spec.whatwg.org/#element)? [insertAdjacentElement](https://dom.spec.whatwg.org/#dom-element-insertadjacentelement)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `where`[](https://dom.spec.whatwg.org/#dom-element-insertadjacentelement-where-element-where), [Element](https://dom.spec.whatwg.org/#element) `element`[](https://dom.spec.whatwg.org/#dom-element-insertadjacentelement-where-element-element)); // legacy -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [insertAdjacentText](https://dom.spec.whatwg.org/#dom-element-insertadjacenttext)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `where`[](https://dom.spec.whatwg.org/#dom-element-insertadjacenttext-where-data-where), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-element-insertadjacenttext-where-data-data)); // legacy + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [namespaceURI](https://dom.spec.whatwg.org/#dom-element-namespaceuri); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [prefix](https://dom.spec.whatwg.org/#dom-element-prefix); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [localName](https://dom.spec.whatwg.org/#dom-element-localname); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [tagName](https://dom.spec.whatwg.org/#dom-element-tagname); + + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [id](https://dom.spec.whatwg.org/#dom-element-id); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [className](https://dom.spec.whatwg.org/#dom-element-classname); + \[[SameObject](https://webidl.spec.whatwg.org/#SameObject), [PutForwards](https://webidl.spec.whatwg.org/#PutForwards)\=[value](https://dom.spec.whatwg.org/#dom-domtokenlist-value)\] readonly attribute [DOMTokenList](https://dom.spec.whatwg.org/#domtokenlist) [classList](https://dom.spec.whatwg.org/#dom-element-classlist); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)\] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [slot](https://dom.spec.whatwg.org/#dom-element-slot); + + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [hasAttributes](https://dom.spec.whatwg.org/#dom-element-hasattributes)(); + \[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [NamedNodeMap](https://dom.spec.whatwg.org/#namednodemap) [attributes](https://dom.spec.whatwg.org/#dom-element-attributes); + [sequence](https://webidl.spec.whatwg.org/#idl-sequence)<[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)\> [getAttributeNames](https://dom.spec.whatwg.org/#dom-element-getattributenames)(); + [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [getAttribute](https://dom.spec.whatwg.org/#dom-element-getattribute)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-getattribute-qualifiedname-qualifiedname)); + [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [getAttributeNS](https://dom.spec.whatwg.org/#dom-element-getattributens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-element-getattributens-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-element-getattributens-namespace-localname-localname)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setAttribute](https://dom.spec.whatwg.org/#dom-element-setattribute)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-setattribute-qualifiedname-value-qualifiedname), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `value`[](https://dom.spec.whatwg.org/#dom-element-setattribute-qualifiedname-value-value)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setAttributeNS](https://dom.spec.whatwg.org/#dom-element-setattributens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-element-setattributens-namespace-qualifiedname-value-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-setattributens-namespace-qualifiedname-value-qualifiedname), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `value`[](https://dom.spec.whatwg.org/#dom-element-setattributens-namespace-qualifiedname-value-value)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [removeAttribute](https://dom.spec.whatwg.org/#dom-element-removeattribute)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-removeattribute-qualifiedname-qualifiedname)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [removeAttributeNS](https://dom.spec.whatwg.org/#dom-element-removeattributens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-element-removeattributens-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-element-removeattributens-namespace-localname-localname)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [toggleAttribute](https://dom.spec.whatwg.org/#dom-element-toggleattribute)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-toggleattribute-qualifiedname-force-qualifiedname), optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `force`[](https://dom.spec.whatwg.org/#dom-element-toggleattribute-qualifiedname-force-force)); + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [hasAttribute](https://dom.spec.whatwg.org/#dom-element-hasattribute)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-hasattribute-qualifiedname-qualifiedname)); + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [hasAttributeNS](https://dom.spec.whatwg.org/#dom-element-hasattributens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-element-hasattributens-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-element-hasattributens-namespace-localname-localname)); + + [Attr](https://dom.spec.whatwg.org/#attr)? [getAttributeNode](https://dom.spec.whatwg.org/#dom-element-getattributenode)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-getattributenode-qualifiedname-qualifiedname)); + [Attr](https://dom.spec.whatwg.org/#attr)? [getAttributeNodeNS](https://dom.spec.whatwg.org/#dom-element-getattributenodens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-element-getattributenodens-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-element-getattributenodens-namespace-localname-localname)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Attr](https://dom.spec.whatwg.org/#attr)? [setAttributeNode](https://dom.spec.whatwg.org/#dom-element-setattributenode)([Attr](https://dom.spec.whatwg.org/#attr) `attr`[](https://dom.spec.whatwg.org/#dom-element-setattributenode-attr-attr)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Attr](https://dom.spec.whatwg.org/#attr)? [setAttributeNodeNS](https://dom.spec.whatwg.org/#dom-element-setattributenodens)([Attr](https://dom.spec.whatwg.org/#attr) `attr`[](https://dom.spec.whatwg.org/#dom-element-setattributenodens-attr-attr)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Attr](https://dom.spec.whatwg.org/#attr) [removeAttributeNode](https://dom.spec.whatwg.org/#dom-element-removeattributenode)([Attr](https://dom.spec.whatwg.org/#attr) `attr`[](https://dom.spec.whatwg.org/#dom-element-removeattributenode-attr-attr)); + + [ShadowRoot](https://dom.spec.whatwg.org/#shadowroot) [attachShadow](https://dom.spec.whatwg.org/#dom-element-attachshadow)([ShadowRootInit](https://dom.spec.whatwg.org/#dictdef-shadowrootinit) `init`[](https://dom.spec.whatwg.org/#dom-element-attachshadow-init-init)); + readonly attribute [ShadowRoot](https://dom.spec.whatwg.org/#shadowroot)? [shadowRoot](https://dom.spec.whatwg.org/#dom-element-shadowroot); + + [Element](https://dom.spec.whatwg.org/#element)? [closest](https://dom.spec.whatwg.org/#dom-element-closest)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `selectors`[](https://dom.spec.whatwg.org/#dom-element-closest-selectors-selectors)); + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [matches](https://dom.spec.whatwg.org/#dom-element-matches)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `selectors`[](https://dom.spec.whatwg.org/#dom-element-matches-selectors-selectors)); + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [webkitMatchesSelector](https://dom.spec.whatwg.org/#dom-element-webkitmatchesselector)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `selectors`[](https://dom.spec.whatwg.org/#dom-element-webkitmatchesselector-selectors-selectors)); // legacy alias of .matches + + [HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection) [getElementsByTagName](https://dom.spec.whatwg.org/#dom-element-getelementsbytagname)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-element-getelementsbytagname-qualifiedname-qualifiedname)); + [HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection) [getElementsByTagNameNS](https://dom.spec.whatwg.org/#dom-element-getelementsbytagnamens)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-element-getelementsbytagnamens-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-element-getelementsbytagnamens-namespace-localname-localname)); + [HTMLCollection](https://dom.spec.whatwg.org/#htmlcollection) [getElementsByClassName](https://dom.spec.whatwg.org/#dom-element-getelementsbyclassname)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `classNames`[](https://dom.spec.whatwg.org/#dom-element-getelementsbyclassname-classnames-classnames)); + + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Element](https://dom.spec.whatwg.org/#element)? [insertAdjacentElement](https://dom.spec.whatwg.org/#dom-element-insertadjacentelement)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `where`[](https://dom.spec.whatwg.org/#dom-element-insertadjacentelement-where-element-where), [Element](https://dom.spec.whatwg.org/#element) `element`[](https://dom.spec.whatwg.org/#dom-element-insertadjacentelement-where-element-element)); // legacy + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [insertAdjacentText](https://dom.spec.whatwg.org/#dom-element-insertadjacenttext)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `where`[](https://dom.spec.whatwg.org/#dom-element-insertadjacenttext-where-data-where), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-element-insertadjacenttext-where-data-data)); // legacy }; dictionary `ShadowRootInit` { -required [ShadowRootMode](https://dom.spec.whatwg.org/#enumdef-shadowrootmode) `mode`; -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `delegatesFocus` = false; -[SlotAssignmentMode](https://dom.spec.whatwg.org/#enumdef-slotassignmentmode) `slotAssignment` = "named"; + required [ShadowRootMode](https://dom.spec.whatwg.org/#enumdef-shadowrootmode) `mode`; + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `delegatesFocus` = false; + [SlotAssignmentMode](https://dom.spec.whatwg.org/#enumdef-slotassignmentmode) `slotAssignment` = "named"; }; `[Element](https://dom.spec.whatwg.org/#element)` [nodes](https://dom.spec.whatwg.org/#concept-node) are simply known as elements. @@ -6567,7 +7032,9 @@ An [element](https://dom.spec.whatwg.org/#concept-element)’s qualified name is An [element](https://dom.spec.whatwg.org/#concept-element)’s HTML-uppercased qualified name is the return value of these steps: 1. Let qualifiedName be [this](https://webidl.spec.whatwg.org/#this)’s [qualified name](https://dom.spec.whatwg.org/#concept-element-qualified-name). + 2. If [this](https://webidl.spec.whatwg.org/#this) is in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and its [node document](https://dom.spec.whatwg.org/#concept-node-document) is an [HTML document](https://dom.spec.whatwg.org/#html-document), then set qualifiedName to qualifiedName in [ASCII uppercase](https://infra.spec.whatwg.org/#ascii-uppercase). + 3. Return qualifiedName. User agents could optimize [qualified name](https://dom.spec.whatwg.org/#concept-element-qualified-name) and [HTML-uppercased qualified name](https://dom.spec.whatwg.org/#element-html-uppercased-qualified-name) by storing them in internal slots. @@ -6575,61 +7042,83 @@ User agents could optimize [qualified name](https://dom.spec.whatwg.org/#concept To create an element, given a document, localName, namespace, and optional prefix, is, and synchronous custom elements flag, run these steps: 1. If prefix was not given, let prefix be null. + 2. If is was not given, let is be null. + 3. Let result be null. + 4. Let definition be the result of [looking up a custom element definition](https://html.spec.whatwg.org/multipage/custom-elements.html#look-up-a-custom-element-definition) given document, namespace, localName, and is. + 5. If definition is non-null, and definition’s [name](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-name) is not equal to its [local name](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-local-name) (i.e., definition represents a [customized built-in element](https://html.spec.whatwg.org/multipage/custom-elements.html#customized-built-in-element)), then: - + 1. Let interface be the [element interface](https://dom.spec.whatwg.org/#concept-element-interface) for localName and the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace). + 2. Set result to a new [element](https://dom.spec.whatwg.org/#concept-element) that implements interface, with no attributes, [namespace](https://dom.spec.whatwg.org/#concept-element-namespace) set to the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), [namespace prefix](https://dom.spec.whatwg.org/#concept-element-namespace-prefix) set to prefix, [local name](https://dom.spec.whatwg.org/#concept-element-local-name) set to localName, [custom element state](https://dom.spec.whatwg.org/#concept-element-custom-element-state) set to "`undefined`", [custom element definition](https://dom.spec.whatwg.org/#concept-element-custom-element-definition) set to null, [`is` value](https://dom.spec.whatwg.org/#concept-element-is-value) set to is, and [node document](https://dom.spec.whatwg.org/#concept-node-document) set to document. + 3. If the synchronous custom elements flag is set, then run this step while catching any exceptions: - + 1. [Upgrade](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-upgrade-an-element) element using definition. - + + If this step threw an exception, then: - + 1. [Report the exception](https://html.spec.whatwg.org/multipage/webappapis.html#report-the-exception). + 2. Set result’s [custom element state](https://dom.spec.whatwg.org/#concept-element-custom-element-state) to "`failed`". - + 4. Otherwise, [enqueue a custom element upgrade reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-upgrade-reaction) given result and definition. - + 6. Otherwise, if definition is non-null, then: - + 1. If the synchronous custom elements flag is set, then run these steps while catching any exceptions: - + 1. Let C be definition’s [constructor](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-constructor). + 2. Set result to the result of [constructing](https://webidl.spec.whatwg.org/#construct-a-callback-function) C, with no arguments. + 3. Assert: result’s [custom element state](https://dom.spec.whatwg.org/#concept-element-custom-element-state) and [custom element definition](https://dom.spec.whatwg.org/#concept-element-custom-element-definition) are initialized. + 4. Assert: result’s [namespace](https://dom.spec.whatwg.org/#concept-element-namespace) is the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace). - + IDL enforces that result is an `[HTMLElement](https://html.spec.whatwg.org/multipage/dom.html#htmlelement)` object, which all use the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace). - + 5. If result’s [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute) [is not empty](https://infra.spec.whatwg.org/#list-is-empty), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 6. If result has [children](https://dom.spec.whatwg.org/#concept-tree-child), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 7. If result’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is not null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 8. If result’s [node document](https://dom.spec.whatwg.org/#concept-node-document) is not document, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 9. If result’s [local name](https://dom.spec.whatwg.org/#concept-element-local-name) is not equal to localName, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. - 10. Set result’s [namespace prefix](https://dom.spec.whatwg.org/#concept-element-namespace-prefix) to prefix. - - 11. Set result’s [`is` value](https://dom.spec.whatwg.org/#concept-element-is-value) to null. - + + 10. Set result’s [namespace prefix](https://dom.spec.whatwg.org/#concept-element-namespace-prefix) to prefix. + + 11. Set result’s [`is` value](https://dom.spec.whatwg.org/#concept-element-is-value) to null. + + If any of these steps threw an exception, then: - + 1. [Report the exception](https://html.spec.whatwg.org/multipage/webappapis.html#report-the-exception). + 2. Set result to a new [element](https://dom.spec.whatwg.org/#concept-element) that implements the `[HTMLUnknownElement](https://html.spec.whatwg.org/multipage/dom.html#htmlunknownelement)` interface, with no attributes, [namespace](https://dom.spec.whatwg.org/#concept-element-namespace) set to the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), [namespace prefix](https://dom.spec.whatwg.org/#concept-element-namespace-prefix) set to prefix, [local name](https://dom.spec.whatwg.org/#concept-element-local-name) set to localName, [custom element state](https://dom.spec.whatwg.org/#concept-element-custom-element-state) set to "`failed`", [custom element definition](https://dom.spec.whatwg.org/#concept-element-custom-element-definition) set to null, [`is` value](https://dom.spec.whatwg.org/#concept-element-is-value) set to null, and [node document](https://dom.spec.whatwg.org/#concept-node-document) set to document. - + 2. Otherwise: - + 1. Set result to a new [element](https://dom.spec.whatwg.org/#concept-element) that implements the `[HTMLElement](https://html.spec.whatwg.org/multipage/dom.html#htmlelement)` interface, with no attributes, [namespace](https://dom.spec.whatwg.org/#concept-element-namespace) set to the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), [namespace prefix](https://dom.spec.whatwg.org/#concept-element-namespace-prefix) set to prefix, [local name](https://dom.spec.whatwg.org/#concept-element-local-name) set to localName, [custom element state](https://dom.spec.whatwg.org/#concept-element-custom-element-state) set to "`undefined`", [custom element definition](https://dom.spec.whatwg.org/#concept-element-custom-element-definition) set to null, [`is` value](https://dom.spec.whatwg.org/#concept-element-is-value) set to null, and [node document](https://dom.spec.whatwg.org/#concept-node-document) set to document. + 2. [Enqueue a custom element upgrade reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-upgrade-reaction) given result and definition. - + 7. Otherwise: - + 1. Let interface be the [element interface](https://dom.spec.whatwg.org/#concept-element-interface) for localName and namespace. + 2. Set result to a new [element](https://dom.spec.whatwg.org/#concept-element) that implements interface, with no attributes, [namespace](https://dom.spec.whatwg.org/#concept-element-namespace) set to namespace, [namespace prefix](https://dom.spec.whatwg.org/#concept-element-namespace-prefix) set to prefix, [local name](https://dom.spec.whatwg.org/#concept-element-local-name) set to localName, [custom element state](https://dom.spec.whatwg.org/#concept-element-custom-element-state) set to "`uncustomized`", [custom element definition](https://dom.spec.whatwg.org/#concept-element-custom-element-definition) set to null, [`is` value](https://dom.spec.whatwg.org/#concept-element-is-value) set to is, and [node document](https://dom.spec.whatwg.org/#concept-node-document) set to document. + 3. If namespace is the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), and either localName is a [valid custom element name](https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name) or is is non-null, then set result’s [custom element state](https://dom.spec.whatwg.org/#concept-element-custom-element-state) to "`undefined`". - + 8. Return result. + [Elements](https://dom.spec.whatwg.org/#concept-element) also have an attribute list, which is a [list](https://infra.spec.whatwg.org/#list) exposed through a `[NamedNodeMap](https://dom.spec.whatwg.org/#namednodemap)`. Unless explicitly given when an [element](https://dom.spec.whatwg.org/#concept-element) is created, its [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute) [is empty](https://infra.spec.whatwg.org/#list-is-empty). @@ -6640,59 +7129,86 @@ This and [other specifications](https://dom.spec.whatwg.org/#other-applicable-sp To handle attribute changes for an [attribute](https://dom.spec.whatwg.org/#concept-attribute) attribute with element, oldValue, and newValue, run these steps: 1. [Queue a mutation record](https://dom.spec.whatwg.org/#queue-a-mutation-record) of "`attributes`" for element with attribute’s [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name), attribute’s [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace), oldValue, « », « », null, and null. + 2. If element is [custom](https://dom.spec.whatwg.org/#concept-element-custom), then [enqueue a custom element callback reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction) with element, callback name "`attributeChangedCallback`", and an argument list containing attribute’s [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name), oldValue, newValue, and attribute’s [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace). + 3. Run the [attribute change steps](https://dom.spec.whatwg.org/#concept-element-attributes-change-ext) with element, attribute’s [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name), oldValue, newValue, and attribute’s [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace). + To change an [attribute](https://dom.spec.whatwg.org/#concept-attribute) attribute to value, run these steps: 1. [Handle attribute changes](https://dom.spec.whatwg.org/#handle-attribute-changes) for attribute with attribute’s [element](https://dom.spec.whatwg.org/#concept-attribute-element), attribute’s [value](https://dom.spec.whatwg.org/#concept-attribute-value), and value. + 2. Set attribute’s [value](https://dom.spec.whatwg.org/#concept-attribute-value) to value. + To append an [attribute](https://dom.spec.whatwg.org/#concept-attribute) attribute to an [element](https://dom.spec.whatwg.org/#concept-element) element, run these steps: 1. [Handle attribute changes](https://dom.spec.whatwg.org/#handle-attribute-changes) for attribute with element, null, and attribute’s [value](https://dom.spec.whatwg.org/#concept-attribute-value). + 2. [Append](https://infra.spec.whatwg.org/#list-append) attribute to element’s [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute). + 3. Set attribute’s [element](https://dom.spec.whatwg.org/#concept-attribute-element) to element. + To remove an [attribute](https://dom.spec.whatwg.org/#concept-attribute) attribute, run these steps: 1. [Handle attribute changes](https://dom.spec.whatwg.org/#handle-attribute-changes) for attribute with attribute’s [element](https://dom.spec.whatwg.org/#concept-attribute-element), attribute’s [value](https://dom.spec.whatwg.org/#concept-attribute-value), and null. + 2. [Remove](https://infra.spec.whatwg.org/#list-remove) attribute from attribute’s [element](https://dom.spec.whatwg.org/#concept-attribute-element)’s [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute). 3. Set attribute’s [element](https://dom.spec.whatwg.org/#concept-attribute-element) to null. + To replace an [attribute](https://dom.spec.whatwg.org/#concept-attribute) oldAttr with an [attribute](https://dom.spec.whatwg.org/#concept-attribute) newAttr, run these steps: 1. [Handle attribute changes](https://dom.spec.whatwg.org/#handle-attribute-changes) for oldAttr with oldAttr’s [element](https://dom.spec.whatwg.org/#concept-attribute-element), oldAttr’s [value](https://dom.spec.whatwg.org/#concept-attribute-value), and newAttr’s [value](https://dom.spec.whatwg.org/#concept-attribute-value). + 2. [Replace](https://infra.spec.whatwg.org/#list-replace) oldAttr by newAttr in oldAttr’s [element](https://dom.spec.whatwg.org/#concept-attribute-element)’s [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute). + 3. Set newAttr’s [element](https://dom.spec.whatwg.org/#concept-attribute-element) to oldAttr’s [element](https://dom.spec.whatwg.org/#concept-attribute-element). + 4. Set oldAttr’s [element](https://dom.spec.whatwg.org/#concept-attribute-element) to null. + ---- +___ To get an attribute by name given a qualifiedName and [element](https://dom.spec.whatwg.org/#concept-element) element, run these steps: 1. If element is in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and its [node document](https://dom.spec.whatwg.org/#concept-node-document) is an [HTML document](https://dom.spec.whatwg.org/#html-document), then set qualifiedName to qualifiedName in [ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase). + 2. Return the first [attribute](https://dom.spec.whatwg.org/#concept-attribute) in element’s [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute) whose [qualified name](https://dom.spec.whatwg.org/#concept-attribute-qualified-name) is qualifiedName; otherwise null. + To get an attribute by namespace and local name given a namespace, localName, and [element](https://dom.spec.whatwg.org/#concept-element) element, run these steps: 1. If namespace is the empty string, then set it to null. + 2. Return the [attribute](https://dom.spec.whatwg.org/#concept-attribute) in element’s [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute) whose [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace) is namespace and [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) is localName, if any; otherwise null. + To get an attribute value given an [element](https://dom.spec.whatwg.org/#concept-element) element, localName, and optionally a namespace (null unless stated otherwise), run these steps: 1. Let attr be the result of [getting an attribute](https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace) given namespace, localName, and element. + 2. If attr is null, then return the empty string. + 3. Return attr’s [value](https://dom.spec.whatwg.org/#concept-attribute-value). + To set an attribute given an attr and element, run these steps: 1. If attr’s [element](https://dom.spec.whatwg.org/#concept-attribute-element) is neither null nor element, [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InUseAttributeError](https://webidl.spec.whatwg.org/#inuseattributeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. Let oldAttr be the result of [getting an attribute](https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace) given attr’s [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace), attr’s [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name), and element. + 3. If oldAttr is attr, return attr. + 4. If oldAttr is non-null, then [replace](https://dom.spec.whatwg.org/#concept-element-attributes-replace) oldAttr with attr. + 5. Otherwise, [append](https://dom.spec.whatwg.org/#concept-element-attributes-append) attr to element. + 6. Return oldAttr. + To set an attribute value for an [element](https://dom.spec.whatwg.org/#concept-element) element, using a localName and value, and an optional prefix, and namespace, run these steps: @@ -6701,20 +7217,27 @@ To set an attribute value for an [element](https://dom.spec.whatwg.org/#concept- 3. Let attribute be the result of [getting an attribute](https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace) given namespace, localName, and element. 4. If attribute is null, create an [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace) is namespace, [namespace prefix](https://dom.spec.whatwg.org/#concept-attribute-namespace-prefix) is prefix, [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) is localName, [value](https://dom.spec.whatwg.org/#concept-attribute-value) is value, and [node document](https://dom.spec.whatwg.org/#concept-node-document) is element’s [node document](https://dom.spec.whatwg.org/#concept-node-document), then [append](https://dom.spec.whatwg.org/#concept-element-attributes-append) this [attribute](https://dom.spec.whatwg.org/#concept-attribute) to element, and then return. 5. [Change](https://dom.spec.whatwg.org/#concept-element-attributes-change) attribute to value. + To remove an attribute by name given a qualifiedName and [element](https://dom.spec.whatwg.org/#concept-element) element, run these steps: 1. Let attr be the result of [getting an attribute](https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name) given qualifiedName and element. + 2. If attr is non-null, then [remove](https://dom.spec.whatwg.org/#concept-element-attributes-remove) attr. + 3. Return attr. + To remove an attribute by namespace and local name given a namespace, localName, and [element](https://dom.spec.whatwg.org/#concept-element) element, run these steps: 1. Let attr be the result of [getting an attribute](https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace) given namespace, localName, and element. + 2. If attr is non-null, then [remove](https://dom.spec.whatwg.org/#concept-element-attributes-remove) attr. + 3. Return attr. + ---- +___ An [element](https://dom.spec.whatwg.org/#concept-element) can have an associated unique identifier (ID) @@ -6723,31 +7246,33 @@ Historically [elements](https://dom.spec.whatwg.org/#concept-element) could have Use these [attribute change steps](https://dom.spec.whatwg.org/#concept-element-attributes-change-ext) to update an [element](https://dom.spec.whatwg.org/#concept-element)’s [ID](https://dom.spec.whatwg.org/#concept-id): 1. If localName is `id`, namespace is null, and value is null or the empty string, then unset element’s [ID](https://dom.spec.whatwg.org/#concept-id). + 2. Otherwise, if localName is `id`, namespace is null, then set element’s [ID](https://dom.spec.whatwg.org/#concept-id) to value. + While this specification defines requirements for `class`, `id`, and `slot` [attributes](https://dom.spec.whatwg.org/#concept-attribute) on any [element](https://dom.spec.whatwg.org/#concept-element), it makes no claims as to whether using them is conforming or not. ---- +___ A [node](https://dom.spec.whatwg.org/#concept-node)’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) of type `[Element](https://dom.spec.whatwg.org/#element)` is known as its parent element. If the [node](https://dom.spec.whatwg.org/#concept-node) has a [parent](https://dom.spec.whatwg.org/#concept-tree-parent) of a different type, its [parent element](https://dom.spec.whatwg.org/#parent-element) is null. ---- +___ -[Element/namespaceURI](https://developer.mozilla.org/en-US/docs/Web/API/Element/namespaceURI 'The Element.namespaceURI read-only property returns the namespace URI of the element, or null if the element is not in a namespace.') +[Element/namespaceURI](https://developer.mozilla.org/en-US/docs/Web/API/Element/namespaceURI "The Element.namespaceURI read-only property returns the namespace URI of the element, or null if the element is not in a namespace.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -6755,21 +7280,21 @@ namespace = element . `[namespaceURI](https://dom.spec.whatwg.org/#dom-element-n Returns the [namespace](https://dom.spec.whatwg.org/#concept-element-namespace). -[Element/prefix](https://developer.mozilla.org/en-US/docs/Web/API/Element/prefix 'The Element.prefix read-only property returns the namespace prefix of the specified element, or null if no prefix is specified.') +[Element/prefix](https://developer.mozilla.org/en-US/docs/Web/API/Element/prefix "The Element.prefix read-only property returns the namespace prefix of the specified element, or null if no prefix is specified.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -6777,21 +7302,21 @@ prefix = element . `[prefix](https://dom.spec.whatwg.org/#dom-element-prefix)` Returns the [namespace prefix](https://dom.spec.whatwg.org/#concept-element-namespace-prefix). -[Element/localName](https://developer.mozilla.org/en-US/docs/Web/API/Element/localName 'The Element.localName read-only property returns the local part of the qualified name of an element.') +[Element/localName](https://developer.mozilla.org/en-US/docs/Web/API/Element/localName "The Element.localName read-only property returns the local part of the qualified name of an element.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -6805,15 +7330,15 @@ In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera8+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -6829,7 +7354,7 @@ The `localName` getter steps are to return [this](https://webidl.spec.whatwg.org The `tagName` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [HTML-uppercased qualified name](https://dom.spec.whatwg.org/#element-html-uppercased-qualified-name). ---- +___ [Element/id](https://developer.mozilla.org/en-US/docs/Web/API/Element/id "The id property of the Element interface represents the element's identifier, reflecting the id global attribute.") @@ -6837,15 +7362,15 @@ In all current engines. Firefox1+Safari1+Chrome23+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android25+Android WebView37+Samsung Internet1.5+Opera Mobile12.1+ @@ -6853,21 +7378,21 @@ Firefox for Android4+iOS Safari1+Chrome for Android25+Android WebView37+Samsung Returns the value of element’s `id` content attribute. Can be set to change it. -[Element/className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className 'The className property of the Element interface gets and sets the value of the class attribute of the specified element.') +[Element/className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className "The className property of the Element interface gets and sets the value of the class attribute of the specified element.") In all current engines. Firefox1+Safari1+Chrome22+ ---- +___ Opera8+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android25+Android WebView37+Samsung Internet1.5+Opera Mobile10.1+ @@ -6875,21 +7400,21 @@ Firefox for Android4+iOS Safari1+Chrome for Android25+Android WebView37+Samsung Returns the value of element’s `class` content attribute. Can be set to change it. -[Element/classList](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList 'The Element.classList is a read-only property that returns a live DOMTokenList collection of the class attributes of the element. This can then be used to manipulate the class list.') +[Element/classList](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList "The Element.classList is a read-only property that returns a live DOMTokenList collection of the class attributes of the element. This can then be used to manipulate the class list.") In all current engines. Firefox3.6+Safari7+Chrome22+ ---- +___ Opera11.5+Edge79+ ---- +___ Edge (Legacy)16+IENone ---- +___ Firefox for Android4+iOS Safari7+Chrome for Android25+Android WebView4.4+Samsung Internet1.5+Opera Mobile11.5+ @@ -6897,39 +7422,39 @@ Firefox for Android4+iOS Safari7+Chrome for Android25+Android WebView4.4+Samsung Allows for manipulation of element’s `class` content attribute as a set of whitespace-separated tokens through a `[DOMTokenList](https://dom.spec.whatwg.org/#domtokenlist)` object. -[Element/slot](https://developer.mozilla.org/en-US/docs/Web/API/Element/slot 'The slot property of the Element interface returns the name of the shadow DOM slot the element is inserted in.') +[Element/slot](https://developer.mozilla.org/en-US/docs/Web/API/Element/slot "The slot property of the Element interface returns the name of the shadow DOM slot the element is inserted in.") In all current engines. Firefox63+Safari10+Chrome53+ ---- +___ Opera40+Edge79+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android63+iOS Safari10+Chrome for Android53+Android WebView53+Samsung Internet6.0+Opera Mobile41+ -[Global_attributes/slot](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/slot "The slot global attribute assigns a slot in a shadow DOM shadow tree to an element: An element with a slot attribute is assigned to the slot created by the element whose name attribute's value matches that slot attribute's value.") +[Global\_attributes/slot](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/slot "The slot global attribute assigns a slot in a shadow DOM shadow tree to an element: An element with a slot attribute is assigned to the slot created by the element whose name attribute's value matches that slot attribute's value.") In all current engines. Firefox63+Safari10+Chrome53+ ---- +___ Opera40+Edge79+ ---- +___ Edge (Legacy)NoneIE? ---- +___ Firefox for Android63+iOS Safari10+Chrome for Android53+Android WebView53+Samsung Internet6.0+Opera Mobile41+ @@ -6957,23 +7482,23 @@ The `slot` attribute must [reflect](https://dom.spec.whatwg.org/#concept-reflect `id`, `class`, and `slot` are effectively superglobal attributes as they can appear on any element, regardless of that element’s namespace. ---- +___ -[Element/hasAttributes](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributes 'The hasAttributes() method of the Element interface returns a boolean value indicating whether the current element has any attributes or not.') +[Element/hasAttributes](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributes "The hasAttributes() method of the Element interface returns a boolean value indicating whether the current element has any attributes or not.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE8+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -6981,21 +7506,21 @@ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung I Returns true if element has attributes; otherwise false. -[Element/getAttributeNames](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames '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.') +[Element/getAttributeNames](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames "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.") In all current engines. Firefox45+Safari10.1+Chrome61+ ---- +___ Opera48+Edge79+ ---- +___ Edge (Legacy)18IENone ---- +___ Firefox for Android45+iOS Safari10.3+Chrome for Android61+Android WebView61+Samsung Internet8.0+Opera Mobile45+ @@ -7003,21 +7528,21 @@ Firefox for Android45+iOS Safari10.3+Chrome for Android61+Android WebView61+Sams Returns the [qualified names](https://dom.spec.whatwg.org/#concept-attribute-qualified-name) of all element’s [attributes](https://dom.spec.whatwg.org/#concept-attribute). Can contain duplicates. -[Element/getAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute 'The getAttribute() method of the Element interface returns the value of a specified attribute on the element.') +[Element/getAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute "The getAttribute() method of the Element interface returns the value of a specified attribute on the element.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera8+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -7031,15 +7556,15 @@ In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -7047,21 +7572,21 @@ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung I Returns element’s [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace) is namespace and [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) is localName, and null if there is no such [attribute](https://dom.spec.whatwg.org/#concept-attribute) otherwise. -[Element/setAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute '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.') +[Element/setAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute "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.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera8+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -7069,21 +7594,21 @@ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung I Sets the [value](https://dom.spec.whatwg.org/#concept-attribute-value) of element’s first [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [qualified name](https://dom.spec.whatwg.org/#concept-attribute-qualified-name) is qualifiedName to value. -[Element/setAttributeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttributeNS 'setAttributeNS adds a new attribute or changes the value of an attribute with the given namespace and name.') +[Element/setAttributeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttributeNS "setAttributeNS adds a new attribute or changes the value of an attribute with the given namespace and name.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -7091,21 +7616,21 @@ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung I Sets the [value](https://dom.spec.whatwg.org/#concept-attribute-value) of element’s [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace) is namespace and [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) is localName to value. -[Element/removeAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute 'The Element method removeAttribute() removes the attribute with the specified name from the element.') +[Element/removeAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute "The Element method removeAttribute() removes the attribute with the specified name from the element.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera8+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -7113,21 +7638,21 @@ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung I Removes element’s first [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [qualified name](https://dom.spec.whatwg.org/#concept-attribute-qualified-name) is qualifiedName. -[Element/removeAttributeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttributeNS 'The removeAttributeNS() method of the Element interface removes the specified attribute from an element.') +[Element/removeAttributeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttributeNS "The removeAttributeNS() method of the Element interface removes the specified attribute from an element.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -7135,21 +7660,21 @@ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung I Removes element’s [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace) is namespace and [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) is localName. -[Element/toggleAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute 'The toggleAttribute() method of the Element interface toggles a Boolean attribute (removing it if it is present and adding it if it is not present) on the given element.') +[Element/toggleAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute "The toggleAttribute() method of the Element interface toggles a Boolean attribute (removing it if it is present and adding it if it is not present) on the given element.") In all current engines. Firefox63+Safari12+Chrome69+ ---- +___ Opera56+Edge79+ ---- +___ Edge (Legacy)18IENone ---- +___ Firefox for Android63+iOS Safari12+Chrome for Android69+Android WebView69+Samsung Internet10.0+Opera Mobile48+ @@ -7159,21 +7684,21 @@ If force is not given, "toggles" qualifiedName, removing it if it is present and Returns true if qualifiedName is now present; otherwise false. -[Element/hasAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute 'The Element.hasAttribute() method returns a Boolean value indicating whether the specified element has the specified attribute or not.') +[Element/hasAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute "The Element.hasAttribute() method returns a Boolean value indicating whether the specified element has the specified attribute or not.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera8+Edge79+ ---- +___ Edge (Legacy)12+IE8+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -7181,21 +7706,21 @@ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung I Returns true if element has an [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [qualified name](https://dom.spec.whatwg.org/#concept-attribute-qualified-name) is qualifiedName; otherwise false. -[Element/hasAttributeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributeNS 'hasAttributeNS returns a boolean value indicating whether the current element has the specified attribute.') +[Element/hasAttributeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributeNS "hasAttributeNS returns a boolean value indicating whether the current element has the specified attribute.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -7211,15 +7736,15 @@ In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera8+Edge79+ ---- +___ Edge (Legacy)12+IE5.5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -7232,27 +7757,40 @@ These are not guaranteed to be unique. The `getAttribute(qualifiedName)` method steps are: 1. Let attr be the result of [getting an attribute](https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name) given qualifiedName and [this](https://webidl.spec.whatwg.org/#this). + 2. If attr is null, return null. + 3. Return attr’s [value](https://dom.spec.whatwg.org/#concept-attribute-value). + The `getAttributeNS(namespace, localName)` method steps are: 1. Let attr be the result of [getting an attribute](https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace) given namespace, localName, and [this](https://webidl.spec.whatwg.org/#this). + 2. If attr is null, return null. + 3. Return attr’s [value](https://dom.spec.whatwg.org/#concept-attribute-value). + The `setAttribute(qualifiedName, value)` method steps are: 1. If qualifiedName does not match the `[Name](https://www.w3.org/TR/xml/#NT-Name)` production in XML, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. If [this](https://webidl.spec.whatwg.org/#this) is in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and its [node document](https://dom.spec.whatwg.org/#concept-node-document) is an [HTML document](https://dom.spec.whatwg.org/#html-document), then set qualifiedName to qualifiedName in [ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase). + 3. Let attribute be the first [attribute](https://dom.spec.whatwg.org/#concept-attribute) in [this](https://webidl.spec.whatwg.org/#this)’s [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute) whose [qualified name](https://dom.spec.whatwg.org/#concept-attribute-qualified-name) is qualifiedName, and null otherwise. + 4. If attribute is null, create an [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) is qualifiedName, [value](https://dom.spec.whatwg.org/#concept-attribute-value) is value, and [node document](https://dom.spec.whatwg.org/#concept-node-document) is [this](https://webidl.spec.whatwg.org/#this)’s [node document](https://dom.spec.whatwg.org/#concept-node-document), then [append](https://dom.spec.whatwg.org/#concept-element-attributes-append) this [attribute](https://dom.spec.whatwg.org/#concept-attribute) to [this](https://webidl.spec.whatwg.org/#this), and then return. + 5. [Change](https://dom.spec.whatwg.org/#concept-element-attributes-change) attribute to value. + The `setAttributeNS(namespace, qualifiedName, value)` method steps are: 1. Let namespace, prefix, and localName be the result of passing namespace and qualifiedName to [validate and extract](https://dom.spec.whatwg.org/#validate-and-extract). + 2. [Set an attribute value](https://dom.spec.whatwg.org/#concept-element-attributes-set-value) for [this](https://webidl.spec.whatwg.org/#this) using localName, value, and also prefix and namespace. + The `removeAttribute(qualifiedName)` method steps are to [remove an attribute](https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-name) given qualifiedName and [this](https://webidl.spec.whatwg.org/#this), and then return undefined. @@ -7261,226 +7799,250 @@ The `removeAttributeNS(namespace, localName)` method steps are to [remove an att The `hasAttribute(qualifiedName)` method steps are: 1. If [this](https://webidl.spec.whatwg.org/#this) is in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and its [node document](https://dom.spec.whatwg.org/#concept-node-document) is an [HTML document](https://dom.spec.whatwg.org/#html-document), then set qualifiedName to qualifiedName in [ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase). + 2. Return true if [this](https://webidl.spec.whatwg.org/#this) [has](https://dom.spec.whatwg.org/#concept-element-attribute-has) an [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [qualified name](https://dom.spec.whatwg.org/#concept-attribute-qualified-name) is qualifiedName; otherwise false. + The `toggleAttribute(qualifiedName, force)` method steps are: 1. If qualifiedName does not match the `[Name](https://www.w3.org/TR/xml/#NT-Name)` production in XML, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. If [this](https://webidl.spec.whatwg.org/#this) is in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and its [node document](https://dom.spec.whatwg.org/#concept-node-document) is an [HTML document](https://dom.spec.whatwg.org/#html-document), then set qualifiedName to qualifiedName in [ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase). + 3. Let attribute be the first [attribute](https://dom.spec.whatwg.org/#concept-attribute) in [this](https://webidl.spec.whatwg.org/#this)’s [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute) whose [qualified name](https://dom.spec.whatwg.org/#concept-attribute-qualified-name) is qualifiedName, and null otherwise. + 4. If attribute is null, then: - + 1. If force is not given or is true, create an [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) is qualifiedName, [value](https://dom.spec.whatwg.org/#concept-attribute-value) is the empty string, and [node document](https://dom.spec.whatwg.org/#concept-node-document) is [this](https://webidl.spec.whatwg.org/#this)’s [node document](https://dom.spec.whatwg.org/#concept-node-document), then [append](https://dom.spec.whatwg.org/#concept-element-attributes-append) this [attribute](https://dom.spec.whatwg.org/#concept-attribute) to [this](https://webidl.spec.whatwg.org/#this), and then return true. + 2. Return false. - + 5. Otherwise, if force is not given or is false, [remove an attribute](https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-name) given qualifiedName and [this](https://webidl.spec.whatwg.org/#this), and then return false. + 6. Return true. + The `hasAttributeNS(namespace, localName)` method steps are: 1. If namespace is the empty string, then set it to null. + 2. Return true if [this](https://webidl.spec.whatwg.org/#this) [has](https://dom.spec.whatwg.org/#concept-element-attribute-has) an [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace) is namespace and [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) is localName; otherwise false. ---- +___ -[Element/getAttributeNode](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNode 'Returns the specified attribute of the specified element, as an Attr node.') +[Element/getAttributeNode](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNode "Returns the specified attribute of the specified element, as an Attr node.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `getAttributeNode(qualifiedName)` method steps are to return the result of [getting an attribute](https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name) given qualifiedName and [this](https://webidl.spec.whatwg.org/#this). -[Element/getAttributeNodeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNodeNS 'Returns the Attr node for the attribute with the given namespace and name.') +[Element/getAttributeNodeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNodeNS "Returns the Attr node for the attribute with the given namespace and name.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `getAttributeNodeNS(namespace, localName)` method steps are to return the result of [getting an attribute](https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace) given namespace, localName, and [this](https://webidl.spec.whatwg.org/#this). -[Element/setAttributeNode](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttributeNode 'The setAttributeNode() method adds a new Attr node to the specified element.') +[Element/setAttributeNode](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttributeNode "The setAttributeNode() method adds a new Attr node to the specified element.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -[Element/setAttributeNodeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttributeNodeNS 'setAttributeNodeNS adds a new namespaced attribute node to an element.') +[Element/setAttributeNodeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttributeNodeNS "setAttributeNodeNS adds a new namespaced attribute node to an element.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `setAttributeNode(attr)` and `setAttributeNodeNS(attr)` methods steps are to return the result of [setting an attribute](https://dom.spec.whatwg.org/#concept-element-attributes-set) given attr and [this](https://webidl.spec.whatwg.org/#this). -[Element/removeAttributeNode](https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttributeNode 'The removeAttributeNode() method of the Element object removes the specified attribute from the current element.') +[Element/removeAttributeNode](https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttributeNode "The removeAttributeNode() method of the Element object removes the specified attribute from the current element.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `removeAttributeNode(attr)` method steps are: 1. If [this](https://webidl.spec.whatwg.org/#this)’s [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute) does not [contain](https://infra.spec.whatwg.org/#list-contain) attr, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotFoundError](https://webidl.spec.whatwg.org/#notfounderror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. [Remove](https://dom.spec.whatwg.org/#concept-element-attributes-remove) attr. + 3. Return attr. + ---- +___ -[Element/attachShadow](https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow 'The Element.attachShadow() method attaches a shadow DOM tree to the specified element and returns a reference to its ShadowRoot.') +[Element/attachShadow](https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow "The Element.attachShadow() method attaches a shadow DOM tree to the specified element and returns a reference to its ShadowRoot.") In all current engines. Firefox63+Safari10+Chrome53+ ---- +___ Opera40+Edge79+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android63+iOS Safari10+Chrome for Android53+Android WebView53+Samsung Internet6.0+Opera Mobile41+ -`` var shadow = element . `[attachShadow(init)](https://dom.spec.whatwg.org/#dom-element-attachshadow)` `` +``var shadow = element . `[attachShadow(init)](https://dom.spec.whatwg.org/#dom-element-attachshadow)` `` Creates a [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root) for element and returns it. -[Element/shadowRoot](https://developer.mozilla.org/en-US/docs/Web/API/Element/shadowRoot 'The Element.shadowRoot read-only property represents the shadow root hosted by the element.') +[Element/shadowRoot](https://developer.mozilla.org/en-US/docs/Web/API/Element/shadowRoot "The Element.shadowRoot read-only property represents the shadow root hosted by the element.") In all current engines. Firefox63+Safari10+Chrome35+ ---- +___ Opera22+Edge79+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for Android63+iOS Safari10+Chrome for Android35+Android WebView37+Samsung Internet3.0+Opera Mobile22+ -`` var shadow = element . `[shadowRoot](https://dom.spec.whatwg.org/#dom-element-shadowroot)` `` +``var shadow = element . `[shadowRoot](https://dom.spec.whatwg.org/#dom-element-shadowroot)` `` Returns element’s [shadow root](https://dom.spec.whatwg.org/#concept-element-shadow-root), if any, and if [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root)’s [mode](https://dom.spec.whatwg.org/#shadowroot-mode) is "`open`", and null otherwise. The `attachShadow(init)` method steps are: 1. If [this](https://webidl.spec.whatwg.org/#this)’s [namespace](https://dom.spec.whatwg.org/#concept-element-namespace) is not the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. If [this](https://webidl.spec.whatwg.org/#this)’s [local name](https://dom.spec.whatwg.org/#concept-element-local-name) is not one of the following: - + - a [valid custom element name](https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name) - "`article`", "`aside`", "`blockquote`", "`body`", "`div`", "`footer`", "`h1`", "`h2`", "`h3`", "`h4`", "`h5`", "`h6`", "`header`", "`main`", "`nav`", "`p`", "`section`", or "`span`" - + then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. - + 3. If [this](https://webidl.spec.whatwg.org/#this)’s [local name](https://dom.spec.whatwg.org/#concept-element-local-name) is a [valid custom element name](https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name), or [this](https://webidl.spec.whatwg.org/#this)’s [`is` value](https://dom.spec.whatwg.org/#concept-element-is-value) is not null, then: - + 1. Let definition be the result of [looking up a custom element definition](https://html.spec.whatwg.org/multipage/custom-elements.html#look-up-a-custom-element-definition) given [this](https://webidl.spec.whatwg.org/#this)’s [node document](https://dom.spec.whatwg.org/#concept-node-document), its [namespace](https://dom.spec.whatwg.org/#concept-element-namespace), its [local name](https://dom.spec.whatwg.org/#concept-element-local-name), and its [`is` value](https://dom.spec.whatwg.org/#concept-element-is-value). + 2. If definition is not null and definition’s [disable shadow](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-disable-shadow) is true, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. - + 4. If [this](https://webidl.spec.whatwg.org/#this) is a [shadow host](https://dom.spec.whatwg.org/#element-shadow-host), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 5. Let shadow be a new [shadow root](https://dom.spec.whatwg.org/#concept-shadow-root) whose [node document](https://dom.spec.whatwg.org/#concept-node-document) is [this](https://webidl.spec.whatwg.org/#this)’s [node document](https://dom.spec.whatwg.org/#concept-node-document), [host](https://dom.spec.whatwg.org/#concept-documentfragment-host) is [this](https://webidl.spec.whatwg.org/#this), and [mode](https://dom.spec.whatwg.org/#shadowroot-mode) is init\["`[mode](https://dom.spec.whatwg.org/#dom-shadowrootinit-mode)`"\]. + 6. Set shadow’s [delegates focus](https://dom.spec.whatwg.org/#shadowroot-delegates-focus) to init\["`[delegatesFocus](https://dom.spec.whatwg.org/#dom-shadowrootinit-delegatesfocus)`"\]. + 7. If [this](https://webidl.spec.whatwg.org/#this)’s [custom element state](https://dom.spec.whatwg.org/#concept-element-custom-element-state) is "`precustomized`" or "`custom`", then set shadow’s [available to element internals](https://dom.spec.whatwg.org/#shadowroot-available-to-element-internals) to true. + 8. Set shadow’s [slot assignment](https://dom.spec.whatwg.org/#shadowroot-slot-assignment) to init\["`[slotAssignment](https://dom.spec.whatwg.org/#dom-shadowrootinit-slotassignment)`"\]. + 9. Set [this](https://webidl.spec.whatwg.org/#this)’s [shadow root](https://dom.spec.whatwg.org/#concept-element-shadow-root) to shadow. -10. Return shadow. + +10. Return shadow. + The `shadowRoot` getter steps are: 1. Let shadow be [this](https://webidl.spec.whatwg.org/#this)’s [shadow root](https://dom.spec.whatwg.org/#concept-element-shadow-root). + 2. If shadow is null or its [mode](https://dom.spec.whatwg.org/#shadowroot-mode) is "`closed`", then return null. + 3. Return shadow. + ---- +___ -[Element/closest](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest 'The closest() method traverses the Element and its parents (heading toward the document root) until it finds a node that matches the provided selector string. Will return itself or the matching ancestor. If no such element exists, it returns null.') +[Element/closest](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest "The closest() method traverses the Element and its parents (heading toward the document root) until it finds a node that matches the provided selector string. Will return itself or the matching ancestor. If no such element exists, it returns null.") In all current engines. Firefox35+Safari6+Chrome41+ ---- +___ Opera28+Edge79+ ---- +___ Edge (Legacy)15+IENone ---- +___ Firefox for Android35+iOS Safari9+Chrome for Android41+Android WebView41+Samsung Internet4.0+Opera Mobile28+ -`` element . `[closest(selectors)](https://dom.spec.whatwg.org/#dom-element-closest)` `` +``element . `[closest(selectors)](https://dom.spec.whatwg.org/#dom-element-closest)` `` Returns the first (starting at element) [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) that matches selectors, and null otherwise. @@ -7490,19 +8052,19 @@ In all current engines. Firefox34+Safari7+Chrome33+ ---- +___ Opera21+Edge79+ ---- +___ Edge (Legacy)15+IENone ---- +___ Firefox for Android34+iOS Safari8+Chrome for Android33+Android WebView4.4+Samsung Internet2.0+Opera Mobile21+ -`` element . `[matches(selectors)](https://dom.spec.whatwg.org/#dom-element-matches)` `` +``element . `[matches(selectors)](https://dom.spec.whatwg.org/#dom-element-matches)` `` Returns true if matching selectors against element’s [root](https://dom.spec.whatwg.org/#concept-tree-root) yields element; otherwise false. @@ -7517,46 +8079,49 @@ The `closest(selectors)` method steps are: The `matches(selectors)` and `webkitMatchesSelector(selectors)` method steps are: 1. Let s be the result of [parse a selector](https://drafts.csswg.org/selectors-4/#parse-a-selector) from selectors. [\[SELECTORS4\]](https://dom.spec.whatwg.org/#biblio-selectors4) + 2. If s is failure, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 3. If the result of [match a selector against an element](https://drafts.csswg.org/selectors-4/#match-a-selector-against-an-element), using s, [this](https://webidl.spec.whatwg.org/#this), and [:scope element](https://drafts.csswg.org/selectors-4/#scope-element) [this](https://webidl.spec.whatwg.org/#this), returns success, then return true; otherwise, return false. [\[SELECTORS4\]](https://dom.spec.whatwg.org/#biblio-selectors4) + ---- +___ -[Element/getElementsByTagName](https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName 'The Element.getElementsByTagName() method returns a live HTMLCollection of elements with the given tag name.') +[Element/getElementsByTagName](https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName "The Element.getElementsByTagName() method returns a live HTMLCollection of elements with the given tag name.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera8+Edge79+ ---- +___ Edge (Legacy)12+IE5.5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `getElementsByTagName(qualifiedName)` method steps are to return the [list of elements with qualified name qualifiedName](https://dom.spec.whatwg.org/#concept-getelementsbytagname) for [this](https://webidl.spec.whatwg.org/#this). -[Element/getElementsByTagNameNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagNameNS '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.') +[Element/getElementsByTagNameNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagNameNS "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.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -7564,7 +8129,7 @@ The `getElementsByTagNameNS(namespace, localName)` method steps are to return th The `getElementsByClassName(classNames)` method steps are to return the [list of elements with class names classNames](https://dom.spec.whatwg.org/#concept-getelementsbyclassname) for [this](https://webidl.spec.whatwg.org/#this). ---- +___ To insert adjacent, given an [element](https://dom.spec.whatwg.org/#concept-element) element, string where, and a [node](https://dom.spec.whatwg.org/#concept-node) node, run the steps associated with the first [ASCII case-insensitive](https://infra.spec.whatwg.org/#ascii-case-insensitive) match for where: @@ -7592,89 +8157,91 @@ Otherwise [Throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. -[Element/insertAdjacentElement](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentElement 'The insertAdjacentElement() method of the Element interface inserts a given element node at a given position relative to the element it is invoked upon.') +[Element/insertAdjacentElement](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentElement "The insertAdjacentElement() method of the Element interface inserts a given element node at a given position relative to the element it is invoked upon.") In all current engines. Firefox48+Safari3+Chrome1+ ---- +___ Opera8+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android48+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `insertAdjacentElement(where, element)` method steps are to return the result of running [insert adjacent](https://dom.spec.whatwg.org/#insert-adjacent), give [this](https://webidl.spec.whatwg.org/#this), where, and element. -[Element/insertAdjacentText](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentText 'The insertAdjacentText() method of the Element interface inserts a given text node at a given position relative to the element it is invoked upon.') +[Element/insertAdjacentText](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentText "The insertAdjacentText() method of the Element interface inserts a given text node at a given position relative to the element it is invoked upon.") In all current engines. Firefox48+Safari4+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android48+iOS Safari4+Chrome for Android18+Android WebView2.2+Samsung Internet1.0+Opera Mobile12.1+ The `insertAdjacentText(where, data)` method steps are: 1. Let text be a new `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node) whose [data](https://dom.spec.whatwg.org/#concept-cd-data) is data and [node document](https://dom.spec.whatwg.org/#concept-node-document) is [this](https://webidl.spec.whatwg.org/#this)’s [node document](https://dom.spec.whatwg.org/#concept-node-document). + 2. Run [insert adjacent](https://dom.spec.whatwg.org/#insert-adjacent), given [this](https://webidl.spec.whatwg.org/#this), where, and text. + This method returns nothing because it existed before we had a chance to design it. #### 4.9.1. Interface `[NamedNodeMap](https://dom.spec.whatwg.org/#namednodemap)`[](https://dom.spec.whatwg.org/#interface-namednodemap) -[NamedNodeMap](https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap '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.') +[NamedNodeMap](https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap "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.") In all current engines. Firefox34+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android34+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window, -[LegacyUnenumerableNamedProperties](https://webidl.spec.whatwg.org/#LegacyUnenumerableNamedProperties)\] + [LegacyUnenumerableNamedProperties](https://webidl.spec.whatwg.org/#LegacyUnenumerableNamedProperties)\] interface `NamedNodeMap` { -readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [length](https://dom.spec.whatwg.org/#dom-namednodemap-length); -getter [Attr](https://dom.spec.whatwg.org/#attr)? [item](https://dom.spec.whatwg.org/#dom-namednodemap-item)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `index`[](https://dom.spec.whatwg.org/#dom-namednodemap-item-index-index)); -getter [Attr](https://dom.spec.whatwg.org/#attr)? [getNamedItem](https://dom.spec.whatwg.org/#dom-namednodemap-getnameditem)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-namednodemap-getnameditem-qualifiedname-qualifiedname)); -[Attr](https://dom.spec.whatwg.org/#attr)? [getNamedItemNS](https://dom.spec.whatwg.org/#dom-namednodemap-getnameditemns)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-namednodemap-getnameditemns-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-namednodemap-getnameditemns-namespace-localname-localname)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Attr](https://dom.spec.whatwg.org/#attr)? [setNamedItem](https://dom.spec.whatwg.org/#dom-namednodemap-setnameditem)([Attr](https://dom.spec.whatwg.org/#attr) `attr`[](https://dom.spec.whatwg.org/#dom-namednodemap-setnameditem-attr-attr)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Attr](https://dom.spec.whatwg.org/#attr)? [setNamedItemNS](https://dom.spec.whatwg.org/#dom-namednodemap-setnameditemns)([Attr](https://dom.spec.whatwg.org/#attr) `attr`[](https://dom.spec.whatwg.org/#dom-namednodemap-setnameditemns-attr-attr)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Attr](https://dom.spec.whatwg.org/#attr) [removeNamedItem](https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem-qualifiedname-qualifiedname)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Attr](https://dom.spec.whatwg.org/#attr) [removeNamedItemNS](https://dom.spec.whatwg.org/#dom-namednodemap-removenameditemns)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-namednodemap-removenameditemns-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-namednodemap-removenameditemns-namespace-localname-localname)); + readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [length](https://dom.spec.whatwg.org/#dom-namednodemap-length); + getter [Attr](https://dom.spec.whatwg.org/#attr)? [item](https://dom.spec.whatwg.org/#dom-namednodemap-item)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `index`[](https://dom.spec.whatwg.org/#dom-namednodemap-item-index-index)); + getter [Attr](https://dom.spec.whatwg.org/#attr)? [getNamedItem](https://dom.spec.whatwg.org/#dom-namednodemap-getnameditem)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-namednodemap-getnameditem-qualifiedname-qualifiedname)); + [Attr](https://dom.spec.whatwg.org/#attr)? [getNamedItemNS](https://dom.spec.whatwg.org/#dom-namednodemap-getnameditemns)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-namednodemap-getnameditemns-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-namednodemap-getnameditemns-namespace-localname-localname)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Attr](https://dom.spec.whatwg.org/#attr)? [setNamedItem](https://dom.spec.whatwg.org/#dom-namednodemap-setnameditem)([Attr](https://dom.spec.whatwg.org/#attr) `attr`[](https://dom.spec.whatwg.org/#dom-namednodemap-setnameditem-attr-attr)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Attr](https://dom.spec.whatwg.org/#attr)? [setNamedItemNS](https://dom.spec.whatwg.org/#dom-namednodemap-setnameditemns)([Attr](https://dom.spec.whatwg.org/#attr) `attr`[](https://dom.spec.whatwg.org/#dom-namednodemap-setnameditemns-attr-attr)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Attr](https://dom.spec.whatwg.org/#attr) [removeNamedItem](https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`[](https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem-qualifiedname-qualifiedname)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Attr](https://dom.spec.whatwg.org/#attr) [removeNamedItemNS](https://dom.spec.whatwg.org/#dom-namednodemap-removenameditemns)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`[](https://dom.spec.whatwg.org/#dom-namednodemap-removenameditemns-namespace-localname-namespace), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-namednodemap-removenameditemns-namespace-localname-localname)); }; A `[NamedNodeMap](https://dom.spec.whatwg.org/#namednodemap)` has an associated element (an [element](https://dom.spec.whatwg.org/#concept-element)). A `[NamedNodeMap](https://dom.spec.whatwg.org/#namednodemap)` object’s attribute list is its [element](https://dom.spec.whatwg.org/#concept-namednodemap-element)’s [attribute list](https://dom.spec.whatwg.org/#concept-element-attribute). ---- +___ A `[NamedNodeMap](https://dom.spec.whatwg.org/#namednodemap)` object’s [supported property indices](https://webidl.spec.whatwg.org/#dfn-supported-property-indices) are the numbers in the range zero to its [attribute list](https://dom.spec.whatwg.org/#concept-namednodemap-attribute)’s [size](https://infra.spec.whatwg.org/#list-size) minus one, unless the [attribute list](https://dom.spec.whatwg.org/#concept-namednodemap-attribute) [is empty](https://infra.spec.whatwg.org/#list-is-empty), in which case there are no [supported property indices](https://webidl.spec.whatwg.org/#dfn-supported-property-indices). @@ -7683,33 +8250,38 @@ The `length` getter steps are to return the [attribute list](https://dom.spec.wh The `item(index)` method steps are: 1. If index is equal to or greater than [this](https://webidl.spec.whatwg.org/#this)’s [attribute list](https://dom.spec.whatwg.org/#concept-namednodemap-attribute)’s [size](https://infra.spec.whatwg.org/#list-size), then return null. + 2. Otherwise, return [this](https://webidl.spec.whatwg.org/#this)’s [attribute list](https://dom.spec.whatwg.org/#concept-namednodemap-attribute)\[index\]. + A `[NamedNodeMap](https://dom.spec.whatwg.org/#namednodemap)` object’s [supported property names](https://webidl.spec.whatwg.org/#dfn-supported-property-names) are the return value of running these steps: 1. Let names be the [qualified names](https://dom.spec.whatwg.org/#concept-attribute-qualified-name) of the [attributes](https://dom.spec.whatwg.org/#concept-attribute) in this `[NamedNodeMap](https://dom.spec.whatwg.org/#namednodemap)` object’s [attribute list](https://dom.spec.whatwg.org/#concept-namednodemap-attribute), with duplicates omitted, in order. + 2. If this `[NamedNodeMap](https://dom.spec.whatwg.org/#namednodemap)` object’s [element](https://dom.spec.whatwg.org/#concept-namednodemap-element) is in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and its [node document](https://dom.spec.whatwg.org/#concept-node-document) is an [HTML document](https://dom.spec.whatwg.org/#html-document), then [for each](https://infra.spec.whatwg.org/#list-iterate) name in names: - + 1. Let lowercaseName be name, in [ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase). + 2. If lowercaseName is not equal to name, remove name from names. - + 3. Return names. + -[NamedNodeMap/getNamedItem](https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap/getNamedItem 'The getNamedItem() method of the NamedNodeMap interface returns the Attr corresponding to the given name, or null if there is no corresponding attribute.') +[NamedNodeMap/getNamedItem](https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap/getNamedItem "The getNamedItem() method of the NamedNodeMap interface returns the Attr corresponding to the given name, or null if there is no corresponding attribute.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -7722,14 +8294,20 @@ The `setNamedItem(attr)` and `setNamedItemNS(attr)` method steps are to return t The `removeNamedItem(qualifiedName)` method steps are: 1. Let attr be the result of [removing an attribute](https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-name) given qualifiedName and [element](https://dom.spec.whatwg.org/#concept-namednodemap-element). + 2. If attr is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotFoundError](https://webidl.spec.whatwg.org/#notfounderror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 3. Return attr. + The `removeNamedItemNS(namespace, localName)` method steps are: 1. Let attr be the result of [removing an attribute](https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-namespace) given namespace, localName, and [element](https://dom.spec.whatwg.org/#concept-namednodemap-element). + 2. If attr is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotFoundError](https://webidl.spec.whatwg.org/#notfounderror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 3. Return attr. + #### 4.9.2. Interface `[Attr](https://dom.spec.whatwg.org/#attr)`[](https://dom.spec.whatwg.org/#interface-attr) @@ -7739,29 +8317,29 @@ In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera8+Edge79+ ---- +___ Edge (Legacy)12+IE5.5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `Attr` : [Node](https://dom.spec.whatwg.org/#node) { -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [namespaceURI](https://dom.spec.whatwg.org/#dom-attr-namespaceuri); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [prefix](https://dom.spec.whatwg.org/#dom-attr-prefix); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [localName](https://dom.spec.whatwg.org/#dom-attr-localname); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [name](https://dom.spec.whatwg.org/#dom-attr-name); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [value](https://dom.spec.whatwg.org/#dom-attr-value); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [namespaceURI](https://dom.spec.whatwg.org/#dom-attr-namespaceuri); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [prefix](https://dom.spec.whatwg.org/#dom-attr-prefix); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [localName](https://dom.spec.whatwg.org/#dom-attr-localname); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [name](https://dom.spec.whatwg.org/#dom-attr-name); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [value](https://dom.spec.whatwg.org/#dom-attr-value); -readonly attribute [Element](https://dom.spec.whatwg.org/#element)? [ownerElement](https://dom.spec.whatwg.org/#dom-attr-ownerelement); + readonly attribute [Element](https://dom.spec.whatwg.org/#element)? [ownerElement](https://dom.spec.whatwg.org/#dom-attr-ownerelement); -readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [specified](https://dom.spec.whatwg.org/#dom-attr-specified); // useless; always returns true + readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [specified](https://dom.spec.whatwg.org/#dom-attr-specified); // useless; always returns true }; `[Attr](https://dom.spec.whatwg.org/#attr)` [nodes](https://dom.spec.whatwg.org/#concept-node) are simply known as attributes. They are sometimes referred to as _content attributes_ to avoid confusion with IDL attributes. @@ -7778,63 +8356,63 @@ When an [attribute](https://dom.spec.whatwg.org/#concept-attribute) is created, An `A` attribute is an [attribute](https://dom.spec.whatwg.org/#concept-attribute) whose [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) is `A` and whose [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace) and [namespace prefix](https://dom.spec.whatwg.org/#concept-attribute-namespace-prefix) are null. ---- +___ -[Attr/namespaceURI](https://developer.mozilla.org/en-US/docs/Web/API/Attr/namespaceURI 'The Attr.namespaceURI read-only property returns the namespace URI of the attribute, or null if the element is not in a namespace.') +[Attr/namespaceURI](https://developer.mozilla.org/en-US/docs/Web/API/Attr/namespaceURI "The Attr.namespaceURI read-only property returns the namespace URI of the attribute, or null if the element is not in a namespace.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `namespaceURI` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [namespace](https://dom.spec.whatwg.org/#concept-attribute-namespace). -[Attr/prefix](https://developer.mozilla.org/en-US/docs/Web/API/Attr/prefix 'The Attr.prefix read-only property returns the namespace prefix of the specified attribute, or null if no prefix is specified.') +[Attr/prefix](https://developer.mozilla.org/en-US/docs/Web/API/Attr/prefix "The Attr.prefix read-only property returns the namespace prefix of the specified attribute, or null if no prefix is specified.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `prefix` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [namespace prefix](https://dom.spec.whatwg.org/#concept-attribute-namespace-prefix). -[Attr/localName](https://developer.mozilla.org/en-US/docs/Web/API/Attr/localName 'The Attr.localName read-only property returns the local part of the qualified name of an attribute.') +[Attr/localName](https://developer.mozilla.org/en-US/docs/Web/API/Attr/localName "The Attr.localName read-only property returns the local part of the qualified name of an attribute.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -7847,15 +8425,17 @@ The `value` getter steps are to return [this](https://webidl.spec.whatwg.org/#th To set an existing attribute value, given an [attribute](https://dom.spec.whatwg.org/#concept-attribute) attribute and string value, run these steps: 1. If attribute’s [element](https://dom.spec.whatwg.org/#concept-attribute-element) is null, then set attribute’s [value](https://dom.spec.whatwg.org/#concept-attribute-value) to value. + 2. Otherwise, [change](https://dom.spec.whatwg.org/#concept-element-attributes-change) attribute to value. + The `[value](https://dom.spec.whatwg.org/#dom-attr-value)` setter steps are to [set an existing attribute value](https://dom.spec.whatwg.org/#set-an-existing-attribute-value) with [this](https://webidl.spec.whatwg.org/#this) and the given value. ---- +___ The `ownerElement` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [element](https://dom.spec.whatwg.org/#concept-attribute-element). ---- +___ The `specified` getter steps are to return true. @@ -7867,27 +8447,27 @@ In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `CharacterData` : [Node](https://dom.spec.whatwg.org/#node) { -attribute \[[LegacyNullToEmptyString](https://webidl.spec.whatwg.org/#LegacyNullToEmptyString)\] [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [data](https://dom.spec.whatwg.org/#dom-characterdata-data); -readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [length](https://dom.spec.whatwg.org/#dom-characterdata-length); -[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [substringData](https://dom.spec.whatwg.org/#dom-characterdata-substringdata)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-characterdata-substringdata-offset-count-offset), [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `count`[](https://dom.spec.whatwg.org/#dom-characterdata-substringdata-offset-count-count)); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [appendData](https://dom.spec.whatwg.org/#dom-characterdata-appenddata)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-characterdata-appenddata-data-data)); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [insertData](https://dom.spec.whatwg.org/#dom-characterdata-insertdata)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-characterdata-insertdata-offset-data-offset), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-characterdata-insertdata-offset-data-data)); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [deleteData](https://dom.spec.whatwg.org/#dom-characterdata-deletedata)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-characterdata-deletedata-offset-count-offset), [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `count`[](https://dom.spec.whatwg.org/#dom-characterdata-deletedata-offset-count-count)); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [replaceData](https://dom.spec.whatwg.org/#dom-characterdata-replacedata)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-characterdata-replacedata-offset-count-data-offset), [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `count`[](https://dom.spec.whatwg.org/#dom-characterdata-replacedata-offset-count-data-count), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-characterdata-replacedata-offset-count-data-data)); + attribute \[[LegacyNullToEmptyString](https://webidl.spec.whatwg.org/#LegacyNullToEmptyString)\] [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [data](https://dom.spec.whatwg.org/#dom-characterdata-data); + readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [length](https://dom.spec.whatwg.org/#dom-characterdata-length); + [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [substringData](https://dom.spec.whatwg.org/#dom-characterdata-substringdata)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-characterdata-substringdata-offset-count-offset), [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `count`[](https://dom.spec.whatwg.org/#dom-characterdata-substringdata-offset-count-count)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [appendData](https://dom.spec.whatwg.org/#dom-characterdata-appenddata)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-characterdata-appenddata-data-data)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [insertData](https://dom.spec.whatwg.org/#dom-characterdata-insertdata)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-characterdata-insertdata-offset-data-offset), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-characterdata-insertdata-offset-data-data)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [deleteData](https://dom.spec.whatwg.org/#dom-characterdata-deletedata)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-characterdata-deletedata-offset-count-offset), [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `count`[](https://dom.spec.whatwg.org/#dom-characterdata-deletedata-offset-count-count)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [replaceData](https://dom.spec.whatwg.org/#dom-characterdata-replacedata)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-characterdata-replacedata-offset-count-data-offset), [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `count`[](https://dom.spec.whatwg.org/#dom-characterdata-replacedata-offset-count-data-count), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-characterdata-replacedata-offset-count-data-data)); }; `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` is an abstract interface. You cannot get a direct instance of it. It is used by `[Text](https://dom.spec.whatwg.org/#text)`, `[ProcessingInstruction](https://dom.spec.whatwg.org/#processinginstruction)`, and `[Comment](https://dom.spec.whatwg.org/#comment)` [nodes](https://dom.spec.whatwg.org/#concept-node). @@ -7900,16 +8480,19 @@ To replace data of node node with offset offset, count count, and data data, run 2. If offset is greater than length, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[IndexSizeError](https://webidl.spec.whatwg.org/#indexsizeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. 3. If offset plus count is greater than length, then set count to length minus offset. 4. [Queue a mutation record](https://dom.spec.whatwg.org/#queue-a-mutation-record) of "`characterData`" for node with null, null, node’s [data](https://dom.spec.whatwg.org/#concept-cd-data), « », « », null, and null. + 5. Insert data into node’s [data](https://dom.spec.whatwg.org/#concept-cd-data) after offset [code units](https://infra.spec.whatwg.org/#code-unit). 6. Let delete offset be offset + data’s [length](https://infra.spec.whatwg.org/#string-length). 7. Starting from delete offset [code units](https://infra.spec.whatwg.org/#code-unit), remove count [code units](https://infra.spec.whatwg.org/#code-unit) from node’s [data](https://dom.spec.whatwg.org/#concept-cd-data). 8. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is node and [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) is greater than offset but less than or equal to offset plus count, set its [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) to offset. + 9. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [end node](https://dom.spec.whatwg.org/#concept-range-end-node) is node and [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) is greater than offset but less than or equal to offset plus count, set its [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) to offset. -10. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is node and [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) is greater than offset plus count, increase its [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) by data’s [length](https://infra.spec.whatwg.org/#string-length) and decrease it by count. - -11. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [end node](https://dom.spec.whatwg.org/#concept-range-end-node) is node and [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) is greater than offset plus count, increase its [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) by data’s [length](https://infra.spec.whatwg.org/#string-length) and decrease it by count. - -12. If node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is non-null, then run the [children changed steps](https://dom.spec.whatwg.org/#concept-node-children-changed-ext) for node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent). + +10. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is node and [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) is greater than offset plus count, increase its [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) by data’s [length](https://infra.spec.whatwg.org/#string-length) and decrease it by count. + +11. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [end node](https://dom.spec.whatwg.org/#concept-range-end-node) is node and [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) is greater than offset plus count, increase its [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) by data’s [length](https://infra.spec.whatwg.org/#string-length) and decrease it by count. + +12. If node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is non-null, then run the [children changed steps](https://dom.spec.whatwg.org/#concept-node-children-changed-ext) for node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent). To substring data with node node, offset offset, and count count, run these steps: @@ -7924,55 +8507,55 @@ In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `data` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [data](https://dom.spec.whatwg.org/#concept-cd-data). Its setter must [replace data](https://dom.spec.whatwg.org/#concept-cd-replace) with node [this](https://webidl.spec.whatwg.org/#this), offset 0, count [this](https://webidl.spec.whatwg.org/#this)’s [length](https://dom.spec.whatwg.org/#concept-node-length), and data new value. -[CharacterData/length](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/length 'The read-only CharacterData.length property returns the number of characters in the contained data, as a positive integer.') +[CharacterData/length](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/length "The read-only CharacterData.length property returns the number of characters in the contained data, as a positive integer.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `length` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [length](https://dom.spec.whatwg.org/#concept-node-length). -[CharacterData/substringData](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/substringData '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.') +[CharacterData/substringData](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/substringData "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.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -7984,15 +8567,15 @@ In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -8004,55 +8587,55 @@ In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `insertData(offset, data)` method steps are to [replace data](https://dom.spec.whatwg.org/#concept-cd-replace) with node [this](https://webidl.spec.whatwg.org/#this), offset offset, count 0, and data data. -[CharacterData/deleteData](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/deleteData 'The deleteData() method of the CharacterData interface removes all or part of the data from this CharacterData node.') +[CharacterData/deleteData](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/deleteData "The deleteData() method of the CharacterData interface removes all or part of the data from this CharacterData node.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `deleteData(offset, count)` method steps are to [replace data](https://dom.spec.whatwg.org/#concept-cd-replace) with node [this](https://webidl.spec.whatwg.org/#this), offset offset, count count, and data the empty string. -[CharacterData/replaceData](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/replaceData 'The replaceData() of the CharacterData interface replace a part of the data inside the node with the string given in paramater.') +[CharacterData/replaceData](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/replaceData "The replaceData() of the CharacterData interface replace a part of the data inside the node with the string given in paramater.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE6+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -8060,47 +8643,47 @@ The `replaceData(offset, count, data)` method steps are to [replace data](https: ### 4.11. Interface `[Text](https://dom.spec.whatwg.org/#text)`[](https://dom.spec.whatwg.org/#interface-text) -[Text](https://developer.mozilla.org/en-US/docs/Web/API/Text 'The Text interface represents a text node in a DOM tree.') +[Text](https://developer.mozilla.org/en-US/docs/Web/API/Text "The Text interface represents a text node in a DOM tree.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ OperaYesEdge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera MobileYes \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `Text` : [CharacterData](https://dom.spec.whatwg.org/#characterdata) { -[constructor](https://dom.spec.whatwg.org/#dom-text-text)(optional [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-text-text-data-data) = ""); + [constructor](https://dom.spec.whatwg.org/#dom-text-text)(optional [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`[](https://dom.spec.whatwg.org/#dom-text-text-data-data) = ""); -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Text](https://dom.spec.whatwg.org/#text) [splitText](https://dom.spec.whatwg.org/#dom-text-splittext)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-text-splittext-offset-offset)); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [wholeText](https://dom.spec.whatwg.org/#dom-text-wholetext); + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Text](https://dom.spec.whatwg.org/#text) [splitText](https://dom.spec.whatwg.org/#dom-text-splittext)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-text-splittext-offset-offset)); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [wholeText](https://dom.spec.whatwg.org/#dom-text-wholetext); }; -[Text/Text](https://developer.mozilla.org/en-US/docs/Web/API/Text/Text 'The Text() constructor returns a new Text object with the optional string given in parameter as its textual content.') +[Text/Text](https://developer.mozilla.org/en-US/docs/Web/API/Text/Text "The Text() constructor returns a new Text object with the optional string given in parameter as its textual content.") In all current engines. Firefox24+Safari8+Chrome28+ ---- +___ Opera15+Edge79+ ---- +___ Edge (Legacy)16+IENone ---- +___ Firefox for Android24+iOS Safari8+Chrome for Android28+Android WebView37+Samsung Internet2.0+Opera Mobile14+ @@ -8108,51 +8691,51 @@ Firefox for Android24+iOS Safari8+Chrome for Android28+Android WebView37+Samsung Returns a new `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node) whose [data](https://dom.spec.whatwg.org/#concept-cd-data) is data. -[Text/splitText](https://developer.mozilla.org/en-US/docs/Web/API/Text/splitText '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.') +[Text/splitText](https://developer.mozilla.org/en-US/docs/Web/API/Text/splitText "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.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ OperaYesEdge79+ ---- +___ Edge (Legacy)12+IE5+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera MobileYes -`` text . `[splitText(offset)](https://dom.spec.whatwg.org/#dom-text-splittext)` `` +``text . `[splitText(offset)](https://dom.spec.whatwg.org/#dom-text-splittext)` `` Splits [data](https://dom.spec.whatwg.org/#concept-cd-data) at the given offset and returns the remainder as `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node). -[Text/wholeText](https://developer.mozilla.org/en-US/docs/Web/API/Text/wholeText '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.') +[Text/wholeText](https://developer.mozilla.org/en-US/docs/Web/API/Text/wholeText "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.") In all current engines. Firefox3.5+Safari4+Chrome1+ ---- +___ OperaYesEdge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3.2+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera MobileYes -`` text . `[wholeText](https://dom.spec.whatwg.org/#dom-text-wholetext)` `` +``text . `[wholeText](https://dom.spec.whatwg.org/#dom-text-wholetext)` `` Returns the combined [data](https://dom.spec.whatwg.org/#concept-cd-data) of all direct `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node) [siblings](https://dom.spec.whatwg.org/#concept-tree-sibling). ---- +___ An exclusive `[Text](https://dom.spec.whatwg.org/#text)` node is a `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node) that is not a `[CDATASection](https://dom.spec.whatwg.org/#cdatasection)` [node](https://dom.spec.whatwg.org/#concept-node). @@ -8164,7 +8747,7 @@ The child text content[](https://dom.spec.whatwg.org/#concept-child-text-content The descendant text content of a [node](https://dom.spec.whatwg.org/#concept-node) node is the [concatenation](https://infra.spec.whatwg.org/#string-concatenate) of the [data](https://dom.spec.whatwg.org/#concept-cd-data) of all the `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node) [descendants](https://dom.spec.whatwg.org/#concept-tree-descendant) of node, in [tree order](https://dom.spec.whatwg.org/#concept-tree-order). ---- +___ The `new Text(data)` constructor steps are to set [this](https://webidl.spec.whatwg.org/#this)’s [data](https://dom.spec.whatwg.org/#concept-cd-data) to data and [this](https://webidl.spec.whatwg.org/#this)’s [node document](https://dom.spec.whatwg.org/#concept-node-document) to [current global object](https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object)’s [associated `Document`](https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window). @@ -8177,13 +8760,17 @@ To split a `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.w 5. Let new node be a new `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node), with the same [node document](https://dom.spec.whatwg.org/#concept-node-document) as node. Set new node’s [data](https://dom.spec.whatwg.org/#concept-cd-data) to new data. 6. Let parent be node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent). 7. If parent is not null, then: - + 1. [Insert](https://dom.spec.whatwg.org/#concept-node-insert) new node into parent before node’s [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling). + 2. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is node and [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) is greater than offset, set its [start node](https://dom.spec.whatwg.org/#concept-range-start-node) to new node and decrease its [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) by offset. + 3. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [end node](https://dom.spec.whatwg.org/#concept-range-end-node) is node and [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) is greater than offset, set its [end node](https://dom.spec.whatwg.org/#concept-range-end-node) to new node and decrease its [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) by offset. + 4. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is parent and [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) is equal to the [index](https://dom.spec.whatwg.org/#concept-tree-index) of node plus 1, increase its [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) by 1. + 5. For each [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [end node](https://dom.spec.whatwg.org/#concept-range-end-node) is parent and [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) is equal to the [index](https://dom.spec.whatwg.org/#concept-tree-index) of node plus 1, increase its [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) by 1. - + 8. [Replace data](https://dom.spec.whatwg.org/#concept-cd-replace) with node node, offset offset, count count, and data the empty string. 9. Return new node. @@ -8199,15 +8786,15 @@ In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile12.1+ @@ -8223,83 +8810,83 @@ In all current engines. Firefox1+Safari4+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `ProcessingInstruction` : [CharacterData](https://dom.spec.whatwg.org/#characterdata) { -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [target](https://dom.spec.whatwg.org/#dom-processinginstruction-target); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [target](https://dom.spec.whatwg.org/#dom-processinginstruction-target); }; `[ProcessingInstruction](https://dom.spec.whatwg.org/#processinginstruction)` [nodes](https://dom.spec.whatwg.org/#concept-node) have an associated target. -[ProcessingInstruction/target](https://developer.mozilla.org/en-US/docs/Web/API/ProcessingInstruction/target 'The read-only target property of the ProcessingInstruction interface represent the application to which the ProcessingInstruction is targeted.') +[ProcessingInstruction/target](https://developer.mozilla.org/en-US/docs/Web/API/ProcessingInstruction/target "The read-only target property of the ProcessingInstruction interface represent the application to which the ProcessingInstruction is targeted.") In all current engines. Firefox1+Safari4+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ The `target` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [target](https://dom.spec.whatwg.org/#concept-pi-target). -[Comment](https://developer.mozilla.org/en-US/docs/Web/API/Comment '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.') +[Comment](https://developer.mozilla.org/en-US/docs/Web/API/Comment "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.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for AndroidYesiOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] -interface : [CharacterData](https://dom.spec.whatwg.org/#characterdata) { -[constructor](https://dom.spec.whatwg.org/#dom-comment-comment)(optional [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) = ""); +interface : [CharacterData](https://dom.spec.whatwg.org/#characterdata) { + [constructor](https://dom.spec.whatwg.org/#dom-comment-comment)(optional [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) = ""); }; -[Comment/Comment](https://developer.mozilla.org/en-US/docs/Web/API/Comment/Comment 'The Comment() constructor returns a newly created Comment object with the optional string given in parameter as its textual content.') +[Comment/Comment](https://developer.mozilla.org/en-US/docs/Web/API/Comment/Comment "The Comment() constructor returns a newly created Comment object with the optional string given in parameter as its textual content.") In all current engines. Firefox24+Safari7+Chrome29+ ---- +___ Opera16+Edge79+ ---- +___ Edge (Legacy)16+IENone ---- +___ Firefox for Android24+iOS Safari7+Chrome for Android29+Android WebView37+Samsung Internet2.0+Opera Mobile16+ @@ -8319,7 +8906,7 @@ The constructor steps are to set [this](https://webidl.spec.whatwg.org/#this)’ - `[Element](https://dom.spec.whatwg.org/#element)`: `p` - `[Element](https://dom.spec.whatwg.org/#element)`: `Little-endian BOM; decode as big-endian!` - - `[Text](https://dom.spec.whatwg.org/#text)`: CSS 2.1 syndata is + - `[Text](https://dom.spec.whatwg.org/#text)`: CSS 2.1 syndata is - `[Element](https://dom.spec.whatwg.org/#element)`: `` - `[Text](https://dom.spec.whatwg.org/#text)`: awesome - `[Text](https://dom.spec.whatwg.org/#text)`: ! @@ -8354,43 +8941,48 @@ A correct [boundary point](https://dom.spec.whatwg.org/#concept-range-bp)’s [o The position of a [boundary point](https://dom.spec.whatwg.org/#concept-range-bp) (nodeA, offsetA) relative to a [boundary point](https://dom.spec.whatwg.org/#concept-range-bp) (nodeB, offsetB) is before, equal, or after, as returned by these steps: 1. Assert: nodeA and nodeB have the same [root](https://dom.spec.whatwg.org/#concept-tree-root). + 2. If nodeA is nodeB, then return [equal](https://dom.spec.whatwg.org/#concept-range-bp-equal) if offsetA is offsetB, [before](https://dom.spec.whatwg.org/#concept-range-bp-before) if offsetA is less than offsetB, and [after](https://dom.spec.whatwg.org/#concept-range-bp-after) if offsetA is greater than offsetB. 3. If nodeA is [following](https://dom.spec.whatwg.org/#concept-tree-following) nodeB, then if the [position](https://dom.spec.whatwg.org/#concept-range-bp-position) of (nodeB, offsetB) relative to (nodeA, offsetA) is [before](https://dom.spec.whatwg.org/#concept-range-bp-before), return [after](https://dom.spec.whatwg.org/#concept-range-bp-after), and if it is [after](https://dom.spec.whatwg.org/#concept-range-bp-after), return [before](https://dom.spec.whatwg.org/#concept-range-bp-before). + 4. If nodeA is an [ancestor](https://dom.spec.whatwg.org/#concept-tree-ancestor) of nodeB: - + 1. Let child be nodeB. + 2. While child is not a [child](https://dom.spec.whatwg.org/#concept-tree-child) of nodeA, set child to its [parent](https://dom.spec.whatwg.org/#concept-tree-parent). + 3. If child’s [index](https://dom.spec.whatwg.org/#concept-tree-index) is less than offsetA, then return [after](https://dom.spec.whatwg.org/#concept-range-bp-after). - + 5. Return [before](https://dom.spec.whatwg.org/#concept-range-bp-before). + ### 5.3. Interface `[AbstractRange](https://dom.spec.whatwg.org/#abstractrange)`[](https://dom.spec.whatwg.org/#interface-abstractrange) -[AbstractRange](https://developer.mozilla.org/en-US/docs/Web/API/AbstractRange 'The AbstractRange abstract interface is the base class upon which all DOM range types are defined. A range is an object that indicates the start and end points of a section of content within the document.') +[AbstractRange](https://developer.mozilla.org/en-US/docs/Web/API/AbstractRange "The AbstractRange abstract interface is the base class upon which all DOM range types are defined. A range is an object that indicates the start and end points of a section of content within the document.") In all current engines. Firefox69+Safari14.1+Chrome90+ ---- +___ Opera76+Edge90+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for AndroidNoneiOS Safari14.5+Chrome for Android90+Android WebView90+Samsung Internet15.0+Opera Mobile64+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `AbstractRange` { -readonly attribute [Node](https://dom.spec.whatwg.org/#node) [startContainer](https://dom.spec.whatwg.org/#dom-range-startcontainer); -readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [startOffset](https://dom.spec.whatwg.org/#dom-range-startoffset); -readonly attribute [Node](https://dom.spec.whatwg.org/#node) [endContainer](https://dom.spec.whatwg.org/#dom-range-endcontainer); -readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [endOffset](https://dom.spec.whatwg.org/#dom-range-endoffset); -readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [collapsed](https://dom.spec.whatwg.org/#dom-range-collapsed); + readonly attribute [Node](https://dom.spec.whatwg.org/#node) [startContainer](https://dom.spec.whatwg.org/#dom-range-startcontainer); + readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [startOffset](https://dom.spec.whatwg.org/#dom-range-startoffset); + readonly attribute [Node](https://dom.spec.whatwg.org/#node) [endContainer](https://dom.spec.whatwg.org/#dom-range-endcontainer); + readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [endOffset](https://dom.spec.whatwg.org/#dom-range-endoffset); + readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [collapsed](https://dom.spec.whatwg.org/#dom-range-collapsed); }; Objects implementing the `[AbstractRange](https://dom.spec.whatwg.org/#abstractrange)` interface are known as ranges. @@ -8401,57 +8993,57 @@ For convenience, a [range](https://dom.spec.whatwg.org/#concept-range)’s start A [range](https://dom.spec.whatwg.org/#concept-range) is collapsed if its [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is its [end node](https://dom.spec.whatwg.org/#concept-range-end-node) and its [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) is its [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset). -[AbstractRange/startContainer](https://developer.mozilla.org/en-US/docs/Web/API/AbstractRange/startContainer 'The read-only startContainer property of the AbstractRange interface returns the start Node for the range.') +[AbstractRange/startContainer](https://developer.mozilla.org/en-US/docs/Web/API/AbstractRange/startContainer "The read-only startContainer property of the AbstractRange interface returns the start Node for the range.") In all current engines. Firefox69+Safari14.1+Chrome90+ ---- +___ Opera76+Edge90+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for AndroidNoneiOS Safari14.5+Chrome for Android90+Android WebView90+Samsung Internet15.0+Opera Mobile64+ -[Range/startContainer](https://developer.mozilla.org/en-US/docs/Web/API/Range/startContainer 'The Range.startContainer read-only property returns the Node within which the Range starts. To change the start position of a node, use one of the Range.setStart() methods.') +[Range/startContainer](https://developer.mozilla.org/en-US/docs/Web/API/Range/startContainer "The Range.startContainer read-only property returns the Node within which the Range starts. To change the start position of a node, use one of the Range.setStart() methods.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ -[StaticRange/startContainer](https://developer.mozilla.org/en-US/docs/Web/API/StaticRange/startContainer 'The read-only startContainer property of the StaticRange interface returns the start Node for the range.') +[StaticRange/startContainer](https://developer.mozilla.org/en-US/docs/Web/API/StaticRange/startContainer "The read-only startContainer property of the StaticRange interface returns the start Node for the range.") In all current engines. Firefox69+Safari10.1+Chrome60+ ---- +___ Opera47+Edge79+ ---- +___ Edge (Legacy)18IENone ---- +___ Firefox for AndroidNoneiOS Safari10.3+Chrome for Android60+Android WebView60+Samsung Internet8.0+Opera Mobile44+ @@ -8465,33 +9057,33 @@ In all current engines. Firefox69+Safari14.1+Chrome90+ ---- +___ Opera76+Edge90+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for AndroidNoneiOS Safari14.5+Chrome for Android90+Android WebView90+Samsung Internet15.0+Opera Mobile64+ -[Range/startOffset](https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset 'The Range.startOffset read-only property returns a number representing where in the startContainer the Range starts.') +[Range/startOffset](https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset "The Range.startOffset read-only property returns a number representing where in the startContainer the Range starts.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -8501,15 +9093,15 @@ In all current engines. Firefox69+Safari10.1+Chrome60+ ---- +___ Opera47+Edge79+ ---- +___ Edge (Legacy)18IENone ---- +___ Firefox for AndroidNoneiOS Safari10.3+Chrome for Android60+Android WebView60+Samsung Internet8.0+Opera Mobile44+ @@ -8517,57 +9109,57 @@ Firefox for AndroidNoneiOS Safari10.3+Chrome for Android60+Android WebView60+Sam Returns range’s [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset). -[AbstractRange/endContainer](https://developer.mozilla.org/en-US/docs/Web/API/AbstractRange/endContainer 'The endContainer property of the AbstractRange interface returns the Node in which the end of the range is located.') +[AbstractRange/endContainer](https://developer.mozilla.org/en-US/docs/Web/API/AbstractRange/endContainer "The endContainer property of the AbstractRange interface returns the Node in which the end of the range is located.") In all current engines. Firefox69+Safari14.1+Chrome90+ ---- +___ Opera76+Edge90+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for AndroidNoneiOS Safari14.5+Chrome for Android90+Android WebView90+Samsung Internet15.0+Opera Mobile64+ -[Range/endContainer](https://developer.mozilla.org/en-US/docs/Web/API/Range/endContainer 'The Range.endContainer read-only property returns the Node within which the Range ends. To change the end position of a node, use the Range.setEnd() method or a similar one.') +[Range/endContainer](https://developer.mozilla.org/en-US/docs/Web/API/Range/endContainer "The Range.endContainer read-only property returns the Node within which the Range ends. To change the end position of a node, use the Range.setEnd() method or a similar one.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ -[StaticRange/endContainer](https://developer.mozilla.org/en-US/docs/Web/API/StaticRange/endContainer 'The endContainer property of the StaticRange interface returns the end Node for the range.') +[StaticRange/endContainer](https://developer.mozilla.org/en-US/docs/Web/API/StaticRange/endContainer "The endContainer property of the StaticRange interface returns the end Node for the range.") In all current engines. Firefox69+Safari10.1+Chrome60+ ---- +___ Opera47+Edge79+ ---- +___ Edge (Legacy)18IENone ---- +___ Firefox for AndroidNoneiOS Safari10.3+Chrome for Android60+Android WebView60+Samsung Internet8.0+Opera Mobile44+ @@ -8581,33 +9173,33 @@ In all current engines. Firefox69+Safari14.1+Chrome90+ ---- +___ Opera76+Edge90+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for AndroidNoneiOS Safari14.5+Chrome for Android90+Android WebView90+Samsung Internet15.0+Opera Mobile64+ -[Range/endOffset](https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset 'The Range.endOffset read-only property returns a number representing where in the Range.endContainer the Range ends.') +[Range/endOffset](https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset "The Range.endOffset read-only property returns a number representing where in the Range.endContainer the Range ends.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -8617,15 +9209,15 @@ In all current engines. Firefox69+Safari10.1+Chrome60+ ---- +___ Opera47+Edge79+ ---- +___ Edge (Legacy)18IENone ---- +___ Firefox for AndroidNoneiOS Safari10.3+Chrome for Android60+Android WebView60+Samsung Internet8.0+Opera Mobile44+ @@ -8639,33 +9231,33 @@ In all current engines. Firefox69+Safari14.1+Chrome90+ ---- +___ Opera76+Edge90+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for AndroidNoneiOS Safari14.5+Chrome for Android90+Android WebView90+Samsung Internet15.0+Opera Mobile64+ -[Range/collapsed](https://developer.mozilla.org/en-US/docs/Web/API/Range/collapsed 'The Range.collapsed read-only property returns a boolean flag indicating whether the start and end points of the Range are at the same position. It returns true if the start and end boundary points of the Range are the same point in the DOM, false if not.') +[Range/collapsed](https://developer.mozilla.org/en-US/docs/Web/API/Range/collapsed "The Range.collapsed read-only property returns a boolean flag indicating whether the start and end points of the Range are at the same position. It returns true if the start and end boundary points of the Range are the same point in the DOM, false if not.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -8675,15 +9267,15 @@ In all current engines. Firefox69+Safari10.1+Chrome60+ ---- +___ Opera47+Edge79+ ---- +___ Edge (Legacy)18IENone ---- +___ Firefox for AndroidNoneiOS Safari10.3+Chrome for Android60+Android WebView60+Samsung Internet8.0+Opera Mobile44+ @@ -8709,45 +9301,45 @@ In all current engines. Firefox69+Safari10.1+Chrome60+ ---- +___ Opera47+Edge79+ ---- +___ Edge (Legacy)18IENone ---- +___ Firefox for AndroidNoneiOS Safari10.3+Chrome for Android60+Android WebView60+Samsung Internet8.0+Opera Mobile44+ dictionary `StaticRangeInit` { -required [Node](https://dom.spec.whatwg.org/#node) `startContainer`; -required [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `startOffset`; -required [Node](https://dom.spec.whatwg.org/#node) `endContainer`; -required [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `endOffset`; + required [Node](https://dom.spec.whatwg.org/#node) `startContainer`; + required [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `startOffset`; + required [Node](https://dom.spec.whatwg.org/#node) `endContainer`; + required [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `endOffset`; }; \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `StaticRange` : [AbstractRange](https://dom.spec.whatwg.org/#abstractrange) { -[constructor](https://dom.spec.whatwg.org/#dom-staticrange-staticrange)([StaticRangeInit](https://dom.spec.whatwg.org/#dictdef-staticrangeinit) `init`[](https://dom.spec.whatwg.org/#dom-staticrange-staticrange-init-init)); + [constructor](https://dom.spec.whatwg.org/#dom-staticrange-staticrange)([StaticRangeInit](https://dom.spec.whatwg.org/#dictdef-staticrangeinit) `init`[](https://dom.spec.whatwg.org/#dom-staticrange-staticrange-init-init)); }; -[StaticRange/StaticRange](https://developer.mozilla.org/en-US/docs/Web/API/StaticRange/StaticRange 'The StaticRange() constructor creates a new StaticRange object representing a span of content within the DOM.') +[StaticRange/StaticRange](https://developer.mozilla.org/en-US/docs/Web/API/StaticRange/StaticRange "The StaticRange() constructor creates a new StaticRange object representing a span of content within the DOM.") In all current engines. Firefox71+Safari13.1+Chrome90+ ---- +___ Opera76+Edge90+ ---- +___ Edge (Legacy)NoneIENone ---- +___ Firefox for AndroidNoneiOS Safari13.4+Chrome for Android90+Android WebView90+Samsung Internet15.0+Opera Mobile64+ @@ -8758,72 +9350,78 @@ Returns a new [range](https://dom.spec.whatwg.org/#concept-range) object that do The `new StaticRange(init)` constructor steps are: 1. If init\["`[startContainer](https://dom.spec.whatwg.org/#dom-staticrangeinit-startcontainer)`"\] or init\["`[endContainer](https://dom.spec.whatwg.org/#dom-staticrangeinit-endcontainer)`"\] is a `[DocumentType](https://dom.spec.whatwg.org/#documenttype)` or `[Attr](https://dom.spec.whatwg.org/#attr)` [node](https://dom.spec.whatwg.org/#concept-node), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. Set [this](https://webidl.spec.whatwg.org/#this)’s [start](https://dom.spec.whatwg.org/#concept-range-start) to (init\["`[startContainer](https://dom.spec.whatwg.org/#dom-staticrangeinit-startcontainer)`"\], init\["`[startOffset](https://dom.spec.whatwg.org/#dom-staticrangeinit-startoffset)`"\]) and [end](https://dom.spec.whatwg.org/#concept-range-end) to (init\["`[endContainer](https://dom.spec.whatwg.org/#dom-staticrangeinit-endcontainer)`"\], init\["`[endOffset](https://dom.spec.whatwg.org/#dom-staticrangeinit-endoffset)`"\]). + A `[StaticRange](https://dom.spec.whatwg.org/#staticrange)` is valid[](https://dom.spec.whatwg.org/#staticrange-valid) if all of the following are true: - Its [start](https://dom.spec.whatwg.org/#concept-range-start) and [end](https://dom.spec.whatwg.org/#concept-range-end) are in the same [node tree](https://dom.spec.whatwg.org/#concept-node-tree). + - Its [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) is between 0 and its [start node](https://dom.spec.whatwg.org/#concept-range-start-node)’s [length](https://dom.spec.whatwg.org/#concept-node-length), inclusive. + - Its [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) is between 0 and its [end node](https://dom.spec.whatwg.org/#concept-range-end-node)’s [length](https://dom.spec.whatwg.org/#concept-node-length), inclusive. + - Its [start](https://dom.spec.whatwg.org/#concept-range-start) is [before](https://dom.spec.whatwg.org/#concept-range-bp-before) or [equal](https://dom.spec.whatwg.org/#concept-range-bp-equal) to its [end](https://dom.spec.whatwg.org/#concept-range-end). + ### 5.5. Interface `[Range](https://dom.spec.whatwg.org/#range)`[](https://dom.spec.whatwg.org/#interface-range) -[Range](https://developer.mozilla.org/en-US/docs/Web/API/Range 'The Range interface represents a fragment of a document that can contain nodes and parts of text nodes.') +[Range](https://developer.mozilla.org/en-US/docs/Web/API/Range "The Range interface represents a fragment of a document that can contain nodes and parts of text nodes.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `Range` : [AbstractRange](https://dom.spec.whatwg.org/#abstractrange) { -[constructor](https://dom.spec.whatwg.org/#dom-range-range)(); + [constructor](https://dom.spec.whatwg.org/#dom-range-range)(); -readonly attribute [Node](https://dom.spec.whatwg.org/#node) [commonAncestorContainer](https://dom.spec.whatwg.org/#dom-range-commonancestorcontainer); + readonly attribute [Node](https://dom.spec.whatwg.org/#node) [commonAncestorContainer](https://dom.spec.whatwg.org/#dom-range-commonancestorcontainer); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setStart](https://dom.spec.whatwg.org/#dom-range-setstart)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-setstart-node-offset-node), [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-range-setstart-node-offset-offset)); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setEnd](https://dom.spec.whatwg.org/#dom-range-setend)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-setend-node-offset-node), [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-range-setend-node-offset-offset)); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setStartBefore](https://dom.spec.whatwg.org/#dom-range-setstartbefore)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-setstartbefore-node-node)); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setStartAfter](https://dom.spec.whatwg.org/#dom-range-setstartafter)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-setstartafter-node-node)); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setEndBefore](https://dom.spec.whatwg.org/#dom-range-setendbefore)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-setendbefore-node-node)); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setEndAfter](https://dom.spec.whatwg.org/#dom-range-setendafter)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-setendafter-node-node)); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [collapse](https://dom.spec.whatwg.org/#dom-range-collapse)(optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `toStart`[](https://dom.spec.whatwg.org/#dom-range-collapse-tostart-tostart) = false); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [selectNode](https://dom.spec.whatwg.org/#dom-range-selectnode)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-selectnode-node-node)); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [selectNodeContents](https://dom.spec.whatwg.org/#dom-range-selectnodecontents)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-selectnodecontents-node-node)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setStart](https://dom.spec.whatwg.org/#dom-range-setstart)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-setstart-node-offset-node), [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-range-setstart-node-offset-offset)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setEnd](https://dom.spec.whatwg.org/#dom-range-setend)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-setend-node-offset-node), [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-range-setend-node-offset-offset)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setStartBefore](https://dom.spec.whatwg.org/#dom-range-setstartbefore)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-setstartbefore-node-node)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setStartAfter](https://dom.spec.whatwg.org/#dom-range-setstartafter)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-setstartafter-node-node)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setEndBefore](https://dom.spec.whatwg.org/#dom-range-setendbefore)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-setendbefore-node-node)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [setEndAfter](https://dom.spec.whatwg.org/#dom-range-setendafter)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-setendafter-node-node)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [collapse](https://dom.spec.whatwg.org/#dom-range-collapse)(optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `toStart`[](https://dom.spec.whatwg.org/#dom-range-collapse-tostart-tostart) = false); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [selectNode](https://dom.spec.whatwg.org/#dom-range-selectnode)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-selectnode-node-node)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [selectNodeContents](https://dom.spec.whatwg.org/#dom-range-selectnodecontents)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-selectnodecontents-node-node)); -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `START_TO_START` = 0; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `START_TO_END` = 1; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `END_TO_END` = 2; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `END_TO_START` = 3; -[short](https://webidl.spec.whatwg.org/#idl-short) [compareBoundaryPoints](https://dom.spec.whatwg.org/#dom-range-compareboundarypoints)([unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `how`[](https://dom.spec.whatwg.org/#dom-range-compareboundarypoints-how-sourcerange-how), [Range](https://dom.spec.whatwg.org/#range) `sourceRange`[](https://dom.spec.whatwg.org/#dom-range-compareboundarypoints-how-sourcerange-sourcerange)); + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `START_TO_START` = 0; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `START_TO_END` = 1; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `END_TO_END` = 2; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `END_TO_START` = 3; + [short](https://webidl.spec.whatwg.org/#idl-short) [compareBoundaryPoints](https://dom.spec.whatwg.org/#dom-range-compareboundarypoints)([unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `how`[](https://dom.spec.whatwg.org/#dom-range-compareboundarypoints-how-sourcerange-how), [Range](https://dom.spec.whatwg.org/#range) `sourceRange`[](https://dom.spec.whatwg.org/#dom-range-compareboundarypoints-how-sourcerange-sourcerange)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [deleteContents](https://dom.spec.whatwg.org/#dom-range-deletecontents)(); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [DocumentFragment](https://dom.spec.whatwg.org/#documentfragment) [extractContents](https://dom.spec.whatwg.org/#dom-range-extractcontents)(); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [DocumentFragment](https://dom.spec.whatwg.org/#documentfragment) [cloneContents](https://dom.spec.whatwg.org/#dom-range-clonecontents)(); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [insertNode](https://dom.spec.whatwg.org/#dom-range-insertnode)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-insertnode-node-node)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [surroundContents](https://dom.spec.whatwg.org/#dom-range-surroundcontents)([Node](https://dom.spec.whatwg.org/#node) `newParent`[](https://dom.spec.whatwg.org/#dom-range-surroundcontents-newparent-newparent)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [deleteContents](https://dom.spec.whatwg.org/#dom-range-deletecontents)(); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [DocumentFragment](https://dom.spec.whatwg.org/#documentfragment) [extractContents](https://dom.spec.whatwg.org/#dom-range-extractcontents)(); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [DocumentFragment](https://dom.spec.whatwg.org/#documentfragment) [cloneContents](https://dom.spec.whatwg.org/#dom-range-clonecontents)(); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [insertNode](https://dom.spec.whatwg.org/#dom-range-insertnode)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-insertnode-node-node)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [surroundContents](https://dom.spec.whatwg.org/#dom-range-surroundcontents)([Node](https://dom.spec.whatwg.org/#node) `newParent`[](https://dom.spec.whatwg.org/#dom-range-surroundcontents-newparent-newparent)); -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Range](https://dom.spec.whatwg.org/#range) [cloneRange](https://dom.spec.whatwg.org/#dom-range-clonerange)(); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [detach](https://dom.spec.whatwg.org/#dom-range-detach)(); + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [Range](https://dom.spec.whatwg.org/#range) [cloneRange](https://dom.spec.whatwg.org/#dom-range-clonerange)(); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [detach](https://dom.spec.whatwg.org/#dom-range-detach)(); -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [isPointInRange](https://dom.spec.whatwg.org/#dom-range-ispointinrange)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-ispointinrange-node-offset-node), [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-range-ispointinrange-node-offset-offset)); -[short](https://webidl.spec.whatwg.org/#idl-short) [comparePoint](https://dom.spec.whatwg.org/#dom-range-comparepoint)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-comparepoint-node-offset-node), [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-range-comparepoint-node-offset-offset)); + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [isPointInRange](https://dom.spec.whatwg.org/#dom-range-ispointinrange)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-ispointinrange-node-offset-node), [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-range-ispointinrange-node-offset-offset)); + [short](https://webidl.spec.whatwg.org/#idl-short) [comparePoint](https://dom.spec.whatwg.org/#dom-range-comparepoint)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-comparepoint-node-offset-node), [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`[](https://dom.spec.whatwg.org/#dom-range-comparepoint-node-offset-offset)); -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [intersectsNode](https://dom.spec.whatwg.org/#dom-range-intersectsnode)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-intersectsnode-node-node)); + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [intersectsNode](https://dom.spec.whatwg.org/#dom-range-intersectsnode)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-range-intersectsnode-node-node)); -[stringifier](https://dom.spec.whatwg.org/#dom-range-stringifier); + [stringifier](https://dom.spec.whatwg.org/#dom-range-stringifier); }; Objects implementing the `[Range](https://dom.spec.whatwg.org/#range)` interface are known as live ranges. @@ -8839,32 +9437,41 @@ A [node](https://dom.spec.whatwg.org/#concept-node) is partially contained in a Some facts to better understand these definitions: - The content that one would think of as being within the [live range](https://dom.spec.whatwg.org/#concept-live-range) consists of all [contained](https://dom.spec.whatwg.org/#contained) [nodes](https://dom.spec.whatwg.org/#concept-node), plus possibly some of the contents of the [start node](https://dom.spec.whatwg.org/#concept-range-start-node) and [end node](https://dom.spec.whatwg.org/#concept-range-end-node) if those are `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [nodes](https://dom.spec.whatwg.org/#concept-node). + - The [nodes](https://dom.spec.whatwg.org/#concept-node) that are contained in a [live range](https://dom.spec.whatwg.org/#concept-live-range) will generally not be contiguous, because the [parent](https://dom.spec.whatwg.org/#concept-tree-parent) of a [contained](https://dom.spec.whatwg.org/#contained) [node](https://dom.spec.whatwg.org/#concept-node) will not always be [contained](https://dom.spec.whatwg.org/#contained). + - However, the [descendants](https://dom.spec.whatwg.org/#concept-tree-descendant) of a [contained](https://dom.spec.whatwg.org/#contained) [node](https://dom.spec.whatwg.org/#concept-node) are [contained](https://dom.spec.whatwg.org/#contained), and if two [siblings](https://dom.spec.whatwg.org/#concept-tree-sibling) are [contained](https://dom.spec.whatwg.org/#contained), so are any [siblings](https://dom.spec.whatwg.org/#concept-tree-sibling) that lie between them. + - The [start node](https://dom.spec.whatwg.org/#concept-range-start-node) and [end node](https://dom.spec.whatwg.org/#concept-range-end-node) of a [live range](https://dom.spec.whatwg.org/#concept-live-range) are never [contained](https://dom.spec.whatwg.org/#contained) within it. + - The first [contained](https://dom.spec.whatwg.org/#contained) [node](https://dom.spec.whatwg.org/#concept-node) (if there are any) will always be after the [start node](https://dom.spec.whatwg.org/#concept-range-start-node), and the last [contained](https://dom.spec.whatwg.org/#contained) [node](https://dom.spec.whatwg.org/#concept-node) will always be equal to or before the [end node](https://dom.spec.whatwg.org/#concept-range-end-node)’s last [descendant](https://dom.spec.whatwg.org/#concept-tree-descendant). + - There exists a [partially contained](https://dom.spec.whatwg.org/#partially-contained) [node](https://dom.spec.whatwg.org/#concept-node) if and only if the [start node](https://dom.spec.whatwg.org/#concept-range-start-node) and [end node](https://dom.spec.whatwg.org/#concept-range-end-node) are different. + - The `[commonAncestorContainer](https://dom.spec.whatwg.org/#dom-range-commonancestorcontainer)` attribute value is neither [contained](https://dom.spec.whatwg.org/#contained) nor [partially contained](https://dom.spec.whatwg.org/#partially-contained). + - If the [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is an [ancestor](https://dom.spec.whatwg.org/#concept-tree-ancestor) of the [end node](https://dom.spec.whatwg.org/#concept-range-end-node), the common [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) will be the [start node](https://dom.spec.whatwg.org/#concept-range-start-node). Exactly one of its [children](https://dom.spec.whatwg.org/#concept-tree-child) will be [partially contained](https://dom.spec.whatwg.org/#partially-contained), and a [child](https://dom.spec.whatwg.org/#concept-tree-child) will be [contained](https://dom.spec.whatwg.org/#contained) if and only if it [precedes](https://dom.spec.whatwg.org/#concept-tree-preceding) the [partially contained](https://dom.spec.whatwg.org/#partially-contained) [child](https://dom.spec.whatwg.org/#concept-tree-child). If the [end node](https://dom.spec.whatwg.org/#concept-range-end-node) is an [ancestor](https://dom.spec.whatwg.org/#concept-tree-ancestor) of the [start node](https://dom.spec.whatwg.org/#concept-range-start-node), the opposite holds. + - If the [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is not an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of the [end node](https://dom.spec.whatwg.org/#concept-range-end-node), nor vice versa, the common [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) will be distinct from both of them. Exactly two of its [children](https://dom.spec.whatwg.org/#concept-tree-child) will be [partially contained](https://dom.spec.whatwg.org/#partially-contained), and a [child](https://dom.spec.whatwg.org/#concept-tree-child) will be contained if and only if it lies between those two. + ---- +___ -[Range/Range](https://developer.mozilla.org/en-US/docs/Web/API/Range/Range 'The Range() constructor returns a newly created Range object whose start and end is the global Document object.') +[Range/Range](https://developer.mozilla.org/en-US/docs/Web/API/Range/Range "The Range() constructor returns a newly created Range object whose start and end is the global Document object.") In all current engines. Firefox24+Safari8+Chrome29+ ---- +___ Opera16+Edge79+ ---- +___ Edge (Legacy)15+IENone ---- +___ Firefox for Android24+iOS Safari8+Chrome for Android29+Android WebView37+Samsung Internet2.0+Opera Mobile16+ @@ -8874,23 +9481,23 @@ Returns a new [live range](https://dom.spec.whatwg.org/#concept-live-range). The `new Range()` constructor steps are to set [this](https://webidl.spec.whatwg.org/#this)’s [start](https://dom.spec.whatwg.org/#concept-range-start) and [end](https://dom.spec.whatwg.org/#concept-range-end) to ([current global object](https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object)’s [associated `Document`](https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window), 0). ---- +___ -[Range/commonAncestorContainer](https://developer.mozilla.org/en-US/docs/Web/API/Range/commonAncestorContainer 'The Range.commonAncestorContainer read-only property returns the deepest — or furthest down the document tree — Node that contains both boundary points of the Range. This means that if Range.startContainer and Range.endContainer both refer to the same node, this node is the common ancestor container.') +[Range/commonAncestorContainer](https://developer.mozilla.org/en-US/docs/Web/API/Range/commonAncestorContainer "The Range.commonAncestorContainer read-only property returns the deepest — or furthest down the document tree — Node that contains both boundary points of the Range. This means that if Range.startContainer and Range.endContainer both refer to the same node, this node is the common ancestor container.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -8904,7 +9511,7 @@ The `commonAncestorContainer` getter steps are: 2. While container is not an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of [end node](https://dom.spec.whatwg.org/#concept-range-end-node), let container be container’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent). 3. Return container. ---- +___ To set the start or end of a range to a [boundary point](https://dom.spec.whatwg.org/#concept-range-bp) (node, offset), run these steps: @@ -8912,70 +9519,71 @@ To set the start or end of a range to a [boundary point](https://dom.spec.whatwg 2. If offset is greater than node’s [length](https://dom.spec.whatwg.org/#concept-node-length), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[IndexSizeError](https://webidl.spec.whatwg.org/#indexsizeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. 3. Let bp be the [boundary point](https://dom.spec.whatwg.org/#concept-range-bp) (node, offset). 4. If these steps were invoked as "set the start" - + 1. If range’s [root](https://dom.spec.whatwg.org/#concept-range-root) is not equal to node’s [root](https://dom.spec.whatwg.org/#concept-tree-root), or if bp is [after](https://dom.spec.whatwg.org/#concept-range-bp-after) the range’s [end](https://dom.spec.whatwg.org/#concept-range-end), set range’s [end](https://dom.spec.whatwg.org/#concept-range-end) to bp. 2. Set range’s [start](https://dom.spec.whatwg.org/#concept-range-start) to bp. - + If these steps were invoked as "set the end" - + 1. If range’s [root](https://dom.spec.whatwg.org/#concept-range-root) is not equal to node’s [root](https://dom.spec.whatwg.org/#concept-tree-root), or if bp is [before](https://dom.spec.whatwg.org/#concept-range-bp-before) the range’s [start](https://dom.spec.whatwg.org/#concept-range-start), set range’s [start](https://dom.spec.whatwg.org/#concept-range-start) to bp. 2. Set range’s [end](https://dom.spec.whatwg.org/#concept-range-end) to bp. + -[Range/setStart](https://developer.mozilla.org/en-US/docs/Web/API/Range/setStart 'The Range.setStart() method sets the start position of a Range.') +[Range/setStart](https://developer.mozilla.org/en-US/docs/Web/API/Range/setStart "The Range.setStart() method sets the start position of a Range.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `setStart(node, offset)` method steps are to [set the start](https://dom.spec.whatwg.org/#concept-range-bp-set) of [this](https://webidl.spec.whatwg.org/#this) to [boundary point](https://dom.spec.whatwg.org/#concept-range-bp) (node, offset). -[Range/setEnd](https://developer.mozilla.org/en-US/docs/Web/API/Range/setEnd 'The Range.setEnd() method sets the end position of a Range to be located at the given offset into the specified node x.Setting the end point above (higher in the document) than the start point will result in a collapsed range with the start and end points both set to the specified end position.') +[Range/setEnd](https://developer.mozilla.org/en-US/docs/Web/API/Range/setEnd "The Range.setEnd() method sets the end position of a Range to be located at the given offset into the specified node x.Setting the end point above (higher in the document) than the start point will result in a collapsed range with the start and end points both set to the specified end position.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `setEnd(node, offset)` method steps are to [set the end](https://dom.spec.whatwg.org/#concept-range-bp-set) of [this](https://webidl.spec.whatwg.org/#this) to [boundary point](https://dom.spec.whatwg.org/#concept-range-bp) (node, offset). -[Range/setStartBefore](https://developer.mozilla.org/en-US/docs/Web/API/Range/setStartBefore 'The Range.setStartBefore() method sets the start position of a Range relative to another Node. The parent Node of the start of the Range will be the same as that for the referenceNode.') +[Range/setStartBefore](https://developer.mozilla.org/en-US/docs/Web/API/Range/setStartBefore "The Range.setStartBefore() method sets the start position of a Range relative to another Node. The parent Node of the start of the Range will be the same as that for the referenceNode.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -8985,45 +9593,48 @@ The `setStartBefore(node)` method steps are: 2. If parent is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. 3. [Set the start](https://dom.spec.whatwg.org/#concept-range-bp-set) of [this](https://webidl.spec.whatwg.org/#this) to [boundary point](https://dom.spec.whatwg.org/#concept-range-bp) (parent, node’s [index](https://dom.spec.whatwg.org/#concept-tree-index)). -[Range/setStartAfter](https://developer.mozilla.org/en-US/docs/Web/API/Range/setStartAfter 'The Range.setStartAfter() method sets the start position of a Range relative to a Node. The parent Node of the start of the Range will be the same as that for the referenceNode.') +[Range/setStartAfter](https://developer.mozilla.org/en-US/docs/Web/API/Range/setStartAfter "The Range.setStartAfter() method sets the start position of a Range relative to a Node. The parent Node of the start of the Range will be the same as that for the referenceNode.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `setStartAfter(node)` method steps are: 1. Let parent be node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent). + 2. If parent is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 3. [Set the start](https://dom.spec.whatwg.org/#concept-range-bp-set) of [this](https://webidl.spec.whatwg.org/#this) to [boundary point](https://dom.spec.whatwg.org/#concept-range-bp) (parent, node’s [index](https://dom.spec.whatwg.org/#concept-tree-index) plus 1). + -[Range/setEndBefore](https://developer.mozilla.org/en-US/docs/Web/API/Range/setEndBefore 'The Range.setEndBefore() method sets the end position of a Range relative to another Node. The parent Node of end of the Range will be the same as that for the referenceNode.') +[Range/setEndBefore](https://developer.mozilla.org/en-US/docs/Web/API/Range/setEndBefore "The Range.setEndBefore() method sets the end position of a Range relative to another Node. The parent Node of end of the Range will be the same as that for the referenceNode.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -9033,45 +9644,48 @@ The `setEndBefore(node)` method steps are: 2. If parent is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. 3. [Set the end](https://dom.spec.whatwg.org/#concept-range-bp-set) of [this](https://webidl.spec.whatwg.org/#this) to [boundary point](https://dom.spec.whatwg.org/#concept-range-bp) (parent, node’s [index](https://dom.spec.whatwg.org/#concept-tree-index)). -[Range/setEndAfter](https://developer.mozilla.org/en-US/docs/Web/API/Range/setEndAfter 'The Range.setEndAfter() method sets the end position of a Range relative to another Node. The parent Node of end of the Range will be the same as that for the referenceNode.') +[Range/setEndAfter](https://developer.mozilla.org/en-US/docs/Web/API/Range/setEndAfter "The Range.setEndAfter() method sets the end position of a Range relative to another Node. The parent Node of end of the Range will be the same as that for the referenceNode.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `setEndAfter(node)` method steps are: 1. Let parent be node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent). + 2. If parent is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 3. [Set the end](https://dom.spec.whatwg.org/#concept-range-bp-set) of [this](https://webidl.spec.whatwg.org/#this) to [boundary point](https://dom.spec.whatwg.org/#concept-range-bp) (parent, node’s [index](https://dom.spec.whatwg.org/#concept-tree-index) plus 1). + -[Range/collapse](https://developer.mozilla.org/en-US/docs/Web/API/Range/collapse 'The Range.collapse() method collapses the Range to one of its boundary points.') +[Range/collapse](https://developer.mozilla.org/en-US/docs/Web/API/Range/collapse "The Range.collapse() method collapses the Range to one of its boundary points.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -9080,46 +9694,51 @@ The `collapse(toStart)` method steps are to, if toStart is true, set [end](https To select a [node](https://dom.spec.whatwg.org/#concept-node) node within a [range](https://dom.spec.whatwg.org/#concept-range) range, run these steps: 1. Let parent be node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent). + 2. If parent is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 3. Let index be node’s [index](https://dom.spec.whatwg.org/#concept-tree-index). + 4. Set range’s [start](https://dom.spec.whatwg.org/#concept-range-start) to [boundary point](https://dom.spec.whatwg.org/#concept-range-bp) (parent, index). + 5. Set range’s [end](https://dom.spec.whatwg.org/#concept-range-end) to [boundary point](https://dom.spec.whatwg.org/#concept-range-bp) (parent, index plus 1). + -[Range/selectNode](https://developer.mozilla.org/en-US/docs/Web/API/Range/selectNode 'The Range.selectNode() method sets the Range to contain the Node and its contents. The parent Node of the start and end of the Range will be the same as the parent of the referenceNode.') +[Range/selectNode](https://developer.mozilla.org/en-US/docs/Web/API/Range/selectNode "The Range.selectNode() method sets the Range to contain the Node and its contents. The parent Node of the start and end of the Range will be the same as the parent of the referenceNode.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `selectNode(node)` method steps are to [select](https://dom.spec.whatwg.org/#concept-range-select) node within [this](https://webidl.spec.whatwg.org/#this). -[Range/selectNodeContents](https://developer.mozilla.org/en-US/docs/Web/API/Range/selectNodeContents 'The Range.selectNodeContents() method sets the Range to contain the contents of a Node.') +[Range/selectNodeContents](https://developer.mozilla.org/en-US/docs/Web/API/Range/selectNodeContents "The Range.selectNodeContents() method sets the Range to contain the contents of a Node.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -9130,192 +9749,198 @@ The `selectNodeContents(node)` method steps are: 3. Set [start](https://dom.spec.whatwg.org/#concept-range-start) to the [boundary point](https://dom.spec.whatwg.org/#concept-range-bp) (node, 0). 4. Set [end](https://dom.spec.whatwg.org/#concept-range-end) to the [boundary point](https://dom.spec.whatwg.org/#concept-range-bp) (node, length). ---- +___ -[Range/compareBoundaryPoints](https://developer.mozilla.org/en-US/docs/Web/API/Range/compareBoundaryPoints 'The Range.compareBoundaryPoints() method compares the boundary points of the Range with those of another range.') +[Range/compareBoundaryPoints](https://developer.mozilla.org/en-US/docs/Web/API/Range/compareBoundaryPoints "The Range.compareBoundaryPoints() method compares the boundary points of the Range with those of another range.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `compareBoundaryPoints(how, sourceRange)` method steps are: 1. If how is not one of - + - `[START_TO_START](https://dom.spec.whatwg.org/#dom-range-start_to_start)`, - `[START_TO_END](https://dom.spec.whatwg.org/#dom-range-start_to_end)`, - `[END_TO_END](https://dom.spec.whatwg.org/#dom-range-end_to_end)`, and - `[END_TO_START](https://dom.spec.whatwg.org/#dom-range-end_to_start)`, - + then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. - + 2. If [this](https://webidl.spec.whatwg.org/#this)’s [root](https://dom.spec.whatwg.org/#concept-range-root) is not the same as sourceRange’s [root](https://dom.spec.whatwg.org/#concept-range-root), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[WrongDocumentError](https://webidl.spec.whatwg.org/#wrongdocumenterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. 3. If how is: - + `[START_TO_START](https://dom.spec.whatwg.org/#dom-range-start_to_start)`: - + Let this point be [this](https://webidl.spec.whatwg.org/#this)’s [start](https://dom.spec.whatwg.org/#concept-range-start). Let other point be sourceRange’s [start](https://dom.spec.whatwg.org/#concept-range-start). - + `[START_TO_END](https://dom.spec.whatwg.org/#dom-range-start_to_end)`: - + Let this point be [this](https://webidl.spec.whatwg.org/#this)’s [end](https://dom.spec.whatwg.org/#concept-range-end). Let other point be sourceRange’s [start](https://dom.spec.whatwg.org/#concept-range-start). - + `[END_TO_END](https://dom.spec.whatwg.org/#dom-range-end_to_end)`: - + Let this point be [this](https://webidl.spec.whatwg.org/#this)’s [end](https://dom.spec.whatwg.org/#concept-range-end). Let other point be sourceRange’s [end](https://dom.spec.whatwg.org/#concept-range-end). - + `[END_TO_START](https://dom.spec.whatwg.org/#dom-range-end_to_start)`: - + Let this point be [this](https://webidl.spec.whatwg.org/#this)’s [start](https://dom.spec.whatwg.org/#concept-range-start). Let other point be sourceRange’s [end](https://dom.spec.whatwg.org/#concept-range-end). - + 4. If the [position](https://dom.spec.whatwg.org/#concept-range-bp-position) of this point relative to other point is - + [before](https://dom.spec.whatwg.org/#concept-range-bp-before) - + Return −1. - + [equal](https://dom.spec.whatwg.org/#concept-range-bp-equal) - + Return 0. - + [after](https://dom.spec.whatwg.org/#concept-range-bp-after) - + Return 1. + -[Range/deleteContents](https://developer.mozilla.org/en-US/docs/Web/API/Range/deleteContents 'The Range.deleteContents() method removes the contents of the Range from the Document.') +[Range/deleteContents](https://developer.mozilla.org/en-US/docs/Web/API/Range/deleteContents "The Range.deleteContents() method removes the contents of the Range from the Document.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `deleteContents()` method steps are: 1. If [this](https://webidl.spec.whatwg.org/#this) is [collapsed](https://dom.spec.whatwg.org/#range-collapsed), then return. + 2. Let original start node, original start offset, original end node, and original end offset be [this](https://webidl.spec.whatwg.org/#this)’s [start node](https://dom.spec.whatwg.org/#concept-range-start-node), [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset), [end node](https://dom.spec.whatwg.org/#concept-range-end-node), and [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset), respectively. 3. If original start node is original end node and it is a `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then [replace data](https://dom.spec.whatwg.org/#concept-cd-replace) with node original start node, offset original start offset, count original end offset minus original start offset, and data the empty string, and then return. + 4. Let nodes to remove be a list of all the [nodes](https://dom.spec.whatwg.org/#concept-node) that are [contained](https://dom.spec.whatwg.org/#contained) in [this](https://webidl.spec.whatwg.org/#this), in [tree order](https://dom.spec.whatwg.org/#concept-tree-order), omitting any [node](https://dom.spec.whatwg.org/#concept-node) whose [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is also [contained](https://dom.spec.whatwg.org/#contained) in [this](https://webidl.spec.whatwg.org/#this). 5. If original start node is an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node, set new node to original start node and new offset to original start offset. 6. Otherwise: - 1. Let reference node equal original start node. 2. While reference node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is not null and is not an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node, set reference node to its [parent](https://dom.spec.whatwg.org/#concept-tree-parent). 3. Set new node to the [parent](https://dom.spec.whatwg.org/#concept-tree-parent) of reference node, and new offset to one plus the [index](https://dom.spec.whatwg.org/#concept-tree-index) of reference node. - + If reference node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) were null, it would be the [root](https://dom.spec.whatwg.org/#concept-range-root) of [this](https://webidl.spec.whatwg.org/#this), so would be an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node, and we could not reach this point. - + 7. If original start node is a `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then [replace data](https://dom.spec.whatwg.org/#concept-cd-replace) with node original start node, offset original start offset, count original start node’s [length](https://dom.spec.whatwg.org/#concept-node-length) minus original start offset, data the empty string. + 8. For each node in nodes to remove, in [tree order](https://dom.spec.whatwg.org/#concept-tree-order), [remove](https://dom.spec.whatwg.org/#concept-node-remove) node. + 9. If original end node is a `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then [replace data](https://dom.spec.whatwg.org/#concept-cd-replace) with node original end node, offset 0, count original end offset and data the empty string. -10. Set [start](https://dom.spec.whatwg.org/#concept-range-start) and [end](https://dom.spec.whatwg.org/#concept-range-end) to (new node, new offset). + +10. Set [start](https://dom.spec.whatwg.org/#concept-range-start) and [end](https://dom.spec.whatwg.org/#concept-range-end) to (new node, new offset). To a [live range](https://dom.spec.whatwg.org/#concept-live-range) range, run these steps: 1. Let fragment be a new `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node) whose [node document](https://dom.spec.whatwg.org/#concept-node-document) is range’s [start node](https://dom.spec.whatwg.org/#concept-range-start-node)’s [node document](https://dom.spec.whatwg.org/#concept-node-document). + 2. If range is [collapsed](https://dom.spec.whatwg.org/#range-collapsed), then return fragment. + 3. Let original start node, original start offset, original end node, and original end offset be range’s [start node](https://dom.spec.whatwg.org/#concept-range-start-node), [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset), [end node](https://dom.spec.whatwg.org/#concept-range-end-node), and [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset), respectively. 4. If original start node is original end node and it is a `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then: - + 1. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of original start node. 2. Set the [data](https://dom.spec.whatwg.org/#concept-cd-data) of clone to the result of [substringing data](https://dom.spec.whatwg.org/#concept-cd-substring) with node original start node, offset original start offset, and count original end offset minus original start offset. 3. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. 4. [Replace data](https://dom.spec.whatwg.org/#concept-cd-replace) with node original start node, offset original start offset, count original end offset minus original start offset, and data the empty string. 5. Return fragment. - 5. Let common ancestor be original start node. 6. While common ancestor is not an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node, set common ancestor to its own [parent](https://dom.spec.whatwg.org/#concept-tree-parent). 7. Let first partially contained child be null. 8. If original start node is _not_ an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node, set first partially contained child to the first [child](https://dom.spec.whatwg.org/#concept-tree-child) of common ancestor that is [partially contained](https://dom.spec.whatwg.org/#partially-contained) in range. 9. Let last partially contained child be null. -10. If original end node is _not_ an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original start node, set last partially contained child to the last [child](https://dom.spec.whatwg.org/#concept-tree-child) of common ancestor that is [partially contained](https://dom.spec.whatwg.org/#partially-contained) in range. - +10. If original end node is _not_ an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original start node, set last partially contained child to the last [child](https://dom.spec.whatwg.org/#concept-tree-child) of common ancestor that is [partially contained](https://dom.spec.whatwg.org/#partially-contained) in range. + These variable assignments do actually always make sense. For instance, if original start node is not an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node, original start node is itself [partially contained](https://dom.spec.whatwg.org/#partially-contained) in range, and so are all its [ancestors](https://dom.spec.whatwg.org/#concept-tree-ancestor) up until a [child](https://dom.spec.whatwg.org/#concept-tree-child) of common ancestor. common ancestor cannot be original start node, because it has to be an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node. The other case is similar. Also, notice that the two [children](https://dom.spec.whatwg.org/#concept-tree-child) will never be equal if both are defined. - -11. Let contained children be a list of all [children](https://dom.spec.whatwg.org/#concept-tree-child) of common ancestor that are [contained](https://dom.spec.whatwg.org/#contained) in range, in [tree order](https://dom.spec.whatwg.org/#concept-tree-order). -12. If any member of contained children is a [doctype](https://dom.spec.whatwg.org/#concept-doctype), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. - + +11. Let contained children be a list of all [children](https://dom.spec.whatwg.org/#concept-tree-child) of common ancestor that are [contained](https://dom.spec.whatwg.org/#contained) in range, in [tree order](https://dom.spec.whatwg.org/#concept-tree-order). +12. If any member of contained children is a [doctype](https://dom.spec.whatwg.org/#concept-doctype), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + We do not have to worry about the first or last partially contained node, because a [doctype](https://dom.spec.whatwg.org/#concept-doctype) can never be partially contained. It cannot be a boundary point of a range, and it cannot be the ancestor of anything. - -13. If original start node is an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node, set new node to original start node and new offset to original start offset. -14. Otherwise: -15. Let reference node equal original start node. -16. While reference node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is not null and is not an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node, set reference node to its [parent](https://dom.spec.whatwg.org/#concept-tree-parent). -17. Set new node to the [parent](https://dom.spec.whatwg.org/#concept-tree-parent) of reference node, and new offset to one plus reference node’s [index](https://dom.spec.whatwg.org/#concept-tree-index). - - If reference node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is null, it would be the [root](https://dom.spec.whatwg.org/#concept-range-root) of range, so would be an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node, and we could not reach this point. - -18. If first partially contained child is a `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then: - + +13. If original start node is an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node, set new node to original start node and new offset to original start offset. +14. Otherwise: + 1. Let reference node equal original start node. + 2. While reference node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is not null and is not an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node, set reference node to its [parent](https://dom.spec.whatwg.org/#concept-tree-parent). + 3. Set new node to the [parent](https://dom.spec.whatwg.org/#concept-tree-parent) of reference node, and new offset to one plus reference node’s [index](https://dom.spec.whatwg.org/#concept-tree-index). + + If reference node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is null, it would be the [root](https://dom.spec.whatwg.org/#concept-range-root) of range, so would be an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node, and we could not reach this point. + +15. If first partially contained child is a `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then: + In this case, first partially contained child is original start node. - + 1. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of original start node. 2. Set the [data](https://dom.spec.whatwg.org/#concept-cd-data) of clone to the result of [substringing data](https://dom.spec.whatwg.org/#concept-cd-substring) with node original start node, offset original start offset, and count original start node’s [length](https://dom.spec.whatwg.org/#concept-node-length) minus original start offset. 3. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. 4. [Replace data](https://dom.spec.whatwg.org/#concept-cd-replace) with node original start node, offset original start offset, count original start node’s [length](https://dom.spec.whatwg.org/#concept-node-length) minus original start offset, and data the empty string. - -19. Otherwise, if first partially contained child is not null: -20. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of first partially contained child. -21. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. -22. Let subrange be a new [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start](https://dom.spec.whatwg.org/#concept-range-start) is (original start node, original start offset) and whose [end](https://dom.spec.whatwg.org/#concept-range-end) is (first partially contained child, first partially contained child’s [length](https://dom.spec.whatwg.org/#concept-node-length)). -23. Let subfragment be the result of [extracting](https://dom.spec.whatwg.org/#concept-range-extract) subrange. -24. [Append](https://dom.spec.whatwg.org/#concept-node-append) subfragment to clone. -25. For each contained child in contained children, [append](https://dom.spec.whatwg.org/#concept-node-append) contained child to fragment. -26. If last partially contained child is a `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then: - +16. Otherwise, if first partially contained child is not null: + 1. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of first partially contained child. + 2. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. + 3. Let subrange be a new [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start](https://dom.spec.whatwg.org/#concept-range-start) is (original start node, original start offset) and whose [end](https://dom.spec.whatwg.org/#concept-range-end) is (first partially contained child, first partially contained child’s [length](https://dom.spec.whatwg.org/#concept-node-length)). + 4. Let subfragment be the result of [extracting](https://dom.spec.whatwg.org/#concept-range-extract) subrange. + + 5. [Append](https://dom.spec.whatwg.org/#concept-node-append) subfragment to clone. +17. For each contained child in contained children, [append](https://dom.spec.whatwg.org/#concept-node-append) contained child to fragment. +18. If last partially contained child is a `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then: + In this case, last partially contained child is original end node. - + 1. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of original end node. 2. Set the [data](https://dom.spec.whatwg.org/#concept-cd-data) of clone to the result of [substringing data](https://dom.spec.whatwg.org/#concept-cd-substring) with node original end node, offset 0, and count original end offset. 3. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. 4. [Replace data](https://dom.spec.whatwg.org/#concept-cd-replace) with node original end node, offset 0, count original end offset, and data the empty string. +19. Otherwise, if last partially contained child is not null: + 1. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of last partially contained child. + 2. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. + 3. Let subrange be a new [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start](https://dom.spec.whatwg.org/#concept-range-start) is (last partially contained child, 0) and whose [end](https://dom.spec.whatwg.org/#concept-range-end) is (original end node, original end offset). + 4. Let subfragment be the result of [extracting](https://dom.spec.whatwg.org/#concept-range-extract) subrange. + + 5. [Append](https://dom.spec.whatwg.org/#concept-node-append) subfragment to clone. +20. Set range’s [start](https://dom.spec.whatwg.org/#concept-range-start) and [end](https://dom.spec.whatwg.org/#concept-range-end) to (new node, new offset). +21. Return fragment. -27. Otherwise, if last partially contained child is not null: -28. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of last partially contained child. -29. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. -30. Let subrange be a new [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start](https://dom.spec.whatwg.org/#concept-range-start) is (last partially contained child, 0) and whose [end](https://dom.spec.whatwg.org/#concept-range-end) is (original end node, original end offset). -31. Let subfragment be the result of [extracting](https://dom.spec.whatwg.org/#concept-range-extract) subrange. -32. [Append](https://dom.spec.whatwg.org/#concept-node-append) subfragment to clone. -33. Set range’s [start](https://dom.spec.whatwg.org/#concept-range-start) and [end](https://dom.spec.whatwg.org/#concept-range-end) to (new node, new offset). -34. Return fragment. - -[Range/extractContents](https://developer.mozilla.org/en-US/docs/Web/API/Range/extractContents 'The Range.extractContents() method moves contents of the Range from the document tree into a DocumentFragment.') +[Range/extractContents](https://developer.mozilla.org/en-US/docs/Web/API/Range/extractContents "The Range.extractContents() method moves contents of the Range from the document tree into a DocumentFragment.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -9324,77 +9949,78 @@ The `extractContents()` method steps are to return the result of [extracting](ht To clone the contents of a [live range](https://dom.spec.whatwg.org/#concept-live-range) range, run these steps: 1. Let fragment be a new `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node) whose [node document](https://dom.spec.whatwg.org/#concept-node-document) is range’s [start node](https://dom.spec.whatwg.org/#concept-range-start-node)’s [node document](https://dom.spec.whatwg.org/#concept-node-document). + 2. If range is [collapsed](https://dom.spec.whatwg.org/#range-collapsed), then return fragment. + 3. Let original start node, original start offset, original end node, and original end offset be range’s [start node](https://dom.spec.whatwg.org/#concept-range-start-node), [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset), [end node](https://dom.spec.whatwg.org/#concept-range-end-node), and [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset), respectively. 4. If original start node is original end node and it is a `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then: - + 1. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of original start node. 2. Set the [data](https://dom.spec.whatwg.org/#concept-cd-data) of clone to the result of [substringing data](https://dom.spec.whatwg.org/#concept-cd-substring) with node original start node, offset original start offset, and count original end offset minus original start offset. 3. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. 4. Return fragment. - 5. Let common ancestor be original start node. 6. While common ancestor is not an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node, set common ancestor to its own [parent](https://dom.spec.whatwg.org/#concept-tree-parent). 7. Let first partially contained child be null. 8. If original start node is _not_ an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node, set first partially contained child to the first [child](https://dom.spec.whatwg.org/#concept-tree-child) of common ancestor that is [partially contained](https://dom.spec.whatwg.org/#partially-contained) in range. 9. Let last partially contained child be null. -10. If original end node is _not_ an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original start node, set last partially contained child to the last [child](https://dom.spec.whatwg.org/#concept-tree-child) of common ancestor that is [partially contained](https://dom.spec.whatwg.org/#partially-contained) in range. - +10. If original end node is _not_ an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original start node, set last partially contained child to the last [child](https://dom.spec.whatwg.org/#concept-tree-child) of common ancestor that is [partially contained](https://dom.spec.whatwg.org/#partially-contained) in range. + These variable assignments do actually always make sense. For instance, if original start node is not an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node, original start node is itself [partially contained](https://dom.spec.whatwg.org/#partially-contained) in range, and so are all its [ancestors](https://dom.spec.whatwg.org/#concept-tree-ancestor) up until a [child](https://dom.spec.whatwg.org/#concept-tree-child) of common ancestor. common ancestor cannot be original start node, because it has to be an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of original end node. The other case is similar. Also, notice that the two [children](https://dom.spec.whatwg.org/#concept-tree-child) will never be equal if both are defined. - -11. Let contained children be a list of all [children](https://dom.spec.whatwg.org/#concept-tree-child) of common ancestor that are [contained](https://dom.spec.whatwg.org/#contained) in range, in [tree order](https://dom.spec.whatwg.org/#concept-tree-order). -12. If any member of contained children is a [doctype](https://dom.spec.whatwg.org/#concept-doctype), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. - + +11. Let contained children be a list of all [children](https://dom.spec.whatwg.org/#concept-tree-child) of common ancestor that are [contained](https://dom.spec.whatwg.org/#contained) in range, in [tree order](https://dom.spec.whatwg.org/#concept-tree-order). +12. If any member of contained children is a [doctype](https://dom.spec.whatwg.org/#concept-doctype), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + We do not have to worry about the first or last partially contained node, because a [doctype](https://dom.spec.whatwg.org/#concept-doctype) can never be partially contained. It cannot be a boundary point of a range, and it cannot be the ancestor of anything. - -13. If first partially contained child is a `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then: - + +13. If first partially contained child is a `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then: + In this case, first partially contained child is original start node. - + 1. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of original start node. 2. Set the [data](https://dom.spec.whatwg.org/#concept-cd-data) of clone to the result of [substringing data](https://dom.spec.whatwg.org/#concept-cd-substring) with node original start node, offset original start offset, and count original start node’s [length](https://dom.spec.whatwg.org/#concept-node-length) minus original start offset. 3. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. - -14. Otherwise, if first partially contained child is not null: -15. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of first partially contained child. -16. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. -17. Let subrange be a new [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start](https://dom.spec.whatwg.org/#concept-range-start) is (original start node, original start offset) and whose [end](https://dom.spec.whatwg.org/#concept-range-end) is (first partially contained child, first partially contained child’s [length](https://dom.spec.whatwg.org/#concept-node-length)). -18. Let subfragment be the result of [cloning the contents](https://dom.spec.whatwg.org/#concept-range-clone) of subrange. -19. [Append](https://dom.spec.whatwg.org/#concept-node-append) subfragment to clone. -20. For each contained child in contained children: -21. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of contained child with the _clone children flag_ set. -22. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. -23. If last partially contained child is a `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then: - +14. Otherwise, if first partially contained child is not null: + 1. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of first partially contained child. + 2. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. + 3. Let subrange be a new [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start](https://dom.spec.whatwg.org/#concept-range-start) is (original start node, original start offset) and whose [end](https://dom.spec.whatwg.org/#concept-range-end) is (first partially contained child, first partially contained child’s [length](https://dom.spec.whatwg.org/#concept-node-length)). + 4. Let subfragment be the result of [cloning the contents](https://dom.spec.whatwg.org/#concept-range-clone) of subrange. + + 5. [Append](https://dom.spec.whatwg.org/#concept-node-append) subfragment to clone. +15. For each contained child in contained children: + 1. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of contained child with the _clone children flag_ set. + 2. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. +16. If last partially contained child is a `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [node](https://dom.spec.whatwg.org/#concept-node), then: + In this case, last partially contained child is original end node. - + 1. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of original end node. 2. Set the [data](https://dom.spec.whatwg.org/#concept-cd-data) of clone to the result of [substringing data](https://dom.spec.whatwg.org/#concept-cd-substring) with node original end node, offset 0, and count original end offset. 3. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. +17. Otherwise, if last partially contained child is not null: + 1. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of last partially contained child. + 2. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. + 3. Let subrange be a new [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start](https://dom.spec.whatwg.org/#concept-range-start) is (last partially contained child, 0) and whose [end](https://dom.spec.whatwg.org/#concept-range-end) is (original end node, original end offset). + 4. Let subfragment be the result of [cloning the contents](https://dom.spec.whatwg.org/#concept-range-clone) of subrange. + + 5. [Append](https://dom.spec.whatwg.org/#concept-node-append) subfragment to clone. +18. Return fragment. -24. Otherwise, if last partially contained child is not null: -25. Let clone be a [clone](https://dom.spec.whatwg.org/#concept-node-clone) of last partially contained child. -26. [Append](https://dom.spec.whatwg.org/#concept-node-append) clone to fragment. -27. Let subrange be a new [live range](https://dom.spec.whatwg.org/#concept-live-range) whose [start](https://dom.spec.whatwg.org/#concept-range-start) is (last partially contained child, 0) and whose [end](https://dom.spec.whatwg.org/#concept-range-end) is (original end node, original end offset). -28. Let subfragment be the result of [cloning the contents](https://dom.spec.whatwg.org/#concept-range-clone) of subrange. -29. [Append](https://dom.spec.whatwg.org/#concept-node-append) subfragment to clone. -30. Return fragment. - -[Range/cloneContents](https://developer.mozilla.org/en-US/docs/Web/API/Range/cloneContents 'The Range.cloneContents() returns a DocumentFragment copying the objects of type Node included in the Range.') +[Range/cloneContents](https://developer.mozilla.org/en-US/docs/Web/API/Range/cloneContents "The Range.cloneContents() returns a DocumentFragment copying the objects of type Node included in the Range.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -9411,117 +10037,125 @@ To insert a [node](https://dom.spec.whatwg.org/#concept-node) node into a [live 7. If range’s [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is a `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node), set referenceNode to the result of [splitting](https://dom.spec.whatwg.org/#concept-text-split) it with offset range’s [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset). 8. If node is referenceNode, set referenceNode to its [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling). 9. If node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is non-null, then [remove](https://dom.spec.whatwg.org/#concept-node-remove) node. -10. Let newOffset be parent’s [length](https://dom.spec.whatwg.org/#concept-node-length) if referenceNode is null, and referenceNode’s [index](https://dom.spec.whatwg.org/#concept-tree-index) otherwise. -11. Increase newOffset by node’s [length](https://dom.spec.whatwg.org/#concept-node-length) if node is a `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node), and one otherwise. -12. [Pre-insert](https://dom.spec.whatwg.org/#concept-node-pre-insert) node into parent before referenceNode. -13. If range is [collapsed](https://dom.spec.whatwg.org/#range-collapsed), then set range’s [end](https://dom.spec.whatwg.org/#concept-range-end) to (parent, newOffset). + +10. Let newOffset be parent’s [length](https://dom.spec.whatwg.org/#concept-node-length) if referenceNode is null, and referenceNode’s [index](https://dom.spec.whatwg.org/#concept-tree-index) otherwise. +11. Increase newOffset by node’s [length](https://dom.spec.whatwg.org/#concept-node-length) if node is a `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node), and one otherwise. +12. [Pre-insert](https://dom.spec.whatwg.org/#concept-node-pre-insert) node into parent before referenceNode. +13. If range is [collapsed](https://dom.spec.whatwg.org/#range-collapsed), then set range’s [end](https://dom.spec.whatwg.org/#concept-range-end) to (parent, newOffset). + -[Range/insertNode](https://developer.mozilla.org/en-US/docs/Web/API/Range/insertNode 'The Range.insertNode() method inserts a node at the start of the Range.') +[Range/insertNode](https://developer.mozilla.org/en-US/docs/Web/API/Range/insertNode "The Range.insertNode() method inserts a node at the start of the Range.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `insertNode(node)` method steps are to [insert](https://dom.spec.whatwg.org/#concept-range-insert) node into [this](https://webidl.spec.whatwg.org/#this). -[Range/surroundContents](https://developer.mozilla.org/en-US/docs/Web/API/Range/surroundContents 'The Range.surroundContents() method moves content of the Range into a new node, placing the new node at the start of the specified range.') +[Range/surroundContents](https://developer.mozilla.org/en-US/docs/Web/API/Range/surroundContents "The Range.surroundContents() method moves content of the Range into a new node, placing the new node at the start of the specified range.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `surroundContents(newParent)` method steps are: 1. If a non-`[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node) is [partially contained](https://dom.spec.whatwg.org/#partially-contained) in [this](https://webidl.spec.whatwg.org/#this), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidStateError](https://webidl.spec.whatwg.org/#invalidstateerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. If newParent is a `[Document](https://dom.spec.whatwg.org/#document)`, `[DocumentType](https://dom.spec.whatwg.org/#documenttype)`, or `[DocumentFragment](https://dom.spec.whatwg.org/#documentfragment)` [node](https://dom.spec.whatwg.org/#concept-node), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. - + For historical reasons `[CharacterData](https://dom.spec.whatwg.org/#characterdata)` [nodes](https://dom.spec.whatwg.org/#concept-node) are not checked here and end up throwing later on as a side effect. - + 3. Let fragment be the result of [extracting](https://dom.spec.whatwg.org/#concept-live-range) [this](https://webidl.spec.whatwg.org/#this). + 4. If newParent has [children](https://dom.spec.whatwg.org/#concept-tree-child), then [replace all](https://dom.spec.whatwg.org/#concept-node-replace-all) with null within newParent. + 5. [Insert](https://dom.spec.whatwg.org/#concept-range-insert) newParent into [this](https://webidl.spec.whatwg.org/#this). + 6. [Append](https://dom.spec.whatwg.org/#concept-node-append) fragment to newParent. + 7. [Select](https://dom.spec.whatwg.org/#concept-range-select) newParent within [this](https://webidl.spec.whatwg.org/#this). + -[Range/cloneRange](https://developer.mozilla.org/en-US/docs/Web/API/Range/cloneRange 'The Range.cloneRange() method returns a Range object with boundary points identical to the cloned Range.') +[Range/cloneRange](https://developer.mozilla.org/en-US/docs/Web/API/Range/cloneRange "The Range.cloneRange() method returns a Range object with boundary points identical to the cloned Range.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `cloneRange()` method steps are to return a new [live range](https://dom.spec.whatwg.org/#concept-live-range) with the same [start](https://dom.spec.whatwg.org/#concept-range-start) and [end](https://dom.spec.whatwg.org/#concept-range-end) as [this](https://webidl.spec.whatwg.org/#this). -[Range/detach](https://developer.mozilla.org/en-US/docs/Web/API/Range/detach 'The Range.detach() method does nothing. It used to disable the Range object and enable the browser to release associated resources. The method has been kept for compatibility.') +[Range/detach](https://developer.mozilla.org/en-US/docs/Web/API/Range/detach "The Range.detach() method does nothing. It used to disable the Range object and enable the browser to release associated resources. The method has been kept for compatibility.") Firefox1–15Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4–15iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `detach()` method steps are to do nothing. Its functionality (disabling a `[Range](https://dom.spec.whatwg.org/#range)` object) was removed, but the method itself is preserved for compatibility. ---- +___ -[Range/comparePoint](https://developer.mozilla.org/en-US/docs/Web/API/Range/comparePoint 'The Range.comparePoint() method returns -1, 0, or 1 depending on whether the referenceNode is before, the same as, or after the Range.') +[Range/comparePoint](https://developer.mozilla.org/en-US/docs/Web/API/Range/comparePoint "The Range.comparePoint() method returns -1, 0, or 1 depending on whether the referenceNode is before, the same as, or after the Range.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -9529,21 +10163,21 @@ position = range . `[comparePoint(node, offset)](https://dom.spec.whatwg.org/#do Returns −1 if the point is before the range, 0 if the point is in the range, and 1 if the point is after the range. -[Range/intersectsNode](https://developer.mozilla.org/en-US/docs/Web/API/Range/intersectsNode 'The Range.intersectsNode() method returns a boolean indicating whether the given Node intersects the Range.') +[Range/intersectsNode](https://developer.mozilla.org/en-US/docs/Web/API/Range/intersectsNode "The Range.intersectsNode() method returns a boolean indicating whether the given Node intersects the Range.") In all current engines. Firefox17+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android19+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -9551,21 +10185,21 @@ intersects = range . `[intersectsNode(node)](https://dom.spec.whatwg.org/#dom-ra Returns whether range intersects node. -[Range/isPointInRange](https://developer.mozilla.org/en-US/docs/Web/API/Range/isPointInRange 'The Range.isPointInRange() method returns a boolean indicating whether the given point is in the Range. It returns true if the point (cursor position) at offset within ReferenceNode is within this range.') +[Range/isPointInRange](https://developer.mozilla.org/en-US/docs/Web/API/Range/isPointInRange "The Range.isPointInRange() method returns a boolean indicating whether the given point is in the Range. It returns true if the point (cursor position) at offset within ReferenceNode is within this range.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)15+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ @@ -9586,7 +10220,7 @@ The `comparePoint(node, offset)` method steps are: 5. If (node, offset) is [after](https://dom.spec.whatwg.org/#concept-range-bp-after) [end](https://dom.spec.whatwg.org/#concept-range-end), return 1. 6. Return 0. ---- +___ The `intersectsNode(node)` method steps are: @@ -9597,36 +10231,42 @@ The `intersectsNode(node)` method steps are: 5. If (parent, offset) is [before](https://dom.spec.whatwg.org/#concept-range-bp-before) [end](https://dom.spec.whatwg.org/#concept-range-end) and (parent, offset plus 1) is [after](https://dom.spec.whatwg.org/#concept-range-bp-after) [start](https://dom.spec.whatwg.org/#concept-range-start), return true. 6. Return false. ---- +___ -[Range/toString](https://developer.mozilla.org/en-US/docs/Web/API/Range/toString 'The Range.toString() method is a stringifier returning the text of the Range.') +[Range/toString](https://developer.mozilla.org/en-US/docs/Web/API/Range/toString "The Range.toString() method is a stringifier returning the text of the Range.") In all current engines. Firefox1+Safari1+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The stringification behavior must run these steps: 1. Let s be the empty string. + 2. If [this](https://webidl.spec.whatwg.org/#this)’s [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is [this](https://webidl.spec.whatwg.org/#this)’s [end node](https://dom.spec.whatwg.org/#concept-range-end-node) and it is a `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node), then return the substring of that `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node)’s [data](https://dom.spec.whatwg.org/#concept-cd-data) beginning at [this](https://webidl.spec.whatwg.org/#this)’s [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) and ending at [this](https://webidl.spec.whatwg.org/#this)’s [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset). + 3. If [this](https://webidl.spec.whatwg.org/#this)’s [start node](https://dom.spec.whatwg.org/#concept-range-start-node) is a `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node), then append the substring of that [node](https://dom.spec.whatwg.org/#concept-node)’s [data](https://dom.spec.whatwg.org/#concept-cd-data) from [this](https://webidl.spec.whatwg.org/#this)’s [start offset](https://dom.spec.whatwg.org/#concept-range-start-offset) until the end to s. + 4. Append the [concatenation](https://infra.spec.whatwg.org/#string-concatenate) of the [data](https://dom.spec.whatwg.org/#concept-cd-data) of all `[Text](https://dom.spec.whatwg.org/#text)` [nodes](https://dom.spec.whatwg.org/#concept-node) that are [contained](https://dom.spec.whatwg.org/#contained) in [this](https://webidl.spec.whatwg.org/#this), in [tree order](https://dom.spec.whatwg.org/#concept-tree-order), to s. + 5. If [this](https://webidl.spec.whatwg.org/#this)’s [end node](https://dom.spec.whatwg.org/#concept-range-end-node) is a `[Text](https://dom.spec.whatwg.org/#text)` [node](https://dom.spec.whatwg.org/#concept-node), then append the substring of that [node](https://dom.spec.whatwg.org/#concept-node)’s [data](https://dom.spec.whatwg.org/#concept-cd-data) from its start until [this](https://webidl.spec.whatwg.org/#this)’s [end offset](https://dom.spec.whatwg.org/#concept-range-end-offset) to s. + 6. Return s. + ---- +___ The `[createContextualFragment()](https://w3c.github.io/DOM-Parsing/#dfn-createcontextualfragment-fragment)`, `[getClientRects()](https://drafts.csswg.org/cssom-view-1/#dom-range-getclientrects)`, and `[getBoundingClientRect()](https://drafts.csswg.org/cssom-view-1/#dom-range-getboundingclientrect)` methods are defined in other specifications. [\[DOM-Parsing\]](https://dom.spec.whatwg.org/#biblio-dom-parsing) [\[CSSOM-VIEW\]](https://dom.spec.whatwg.org/#biblio-cssom-view) @@ -9641,46 +10281,54 @@ Each `[NodeIterator](https://dom.spec.whatwg.org/#nodeiterator)` and `[TreeWalke To filter a [node](https://dom.spec.whatwg.org/#concept-node) node within a `[NodeIterator](https://dom.spec.whatwg.org/#nodeiterator)` or `[TreeWalker](https://dom.spec.whatwg.org/#treewalker)` object traverser, run these steps: 1. If traverser’s [active flag](https://dom.spec.whatwg.org/#concept-traversal-active) is set, then throw an "`[InvalidStateError](https://webidl.spec.whatwg.org/#invalidstateerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. Let n be node’s `[nodeType](https://dom.spec.whatwg.org/#dom-node-nodetype)` attribute value − 1. + 3. If the nth bit (where 0 is the least significant bit) of traverser’s [whatToShow](https://dom.spec.whatwg.org/#concept-traversal-whattoshow) is not set, then return `[FILTER_SKIP](https://dom.spec.whatwg.org/#dom-nodefilter-filter_skip)`. + 4. If traverser’s [filter](https://dom.spec.whatwg.org/#concept-traversal-filter) is null, then return `[FILTER_ACCEPT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_accept)`. + 5. Set traverser’s [active flag](https://dom.spec.whatwg.org/#concept-traversal-active). + 6. Let result be the return value of [call a user object’s operation](https://webidl.spec.whatwg.org/#call-a-user-objects-operation) with traverser’s [filter](https://dom.spec.whatwg.org/#concept-traversal-filter), "`acceptNode`", and « node ». If this throws an exception, then unset traverser’s [active flag](https://dom.spec.whatwg.org/#concept-traversal-active) and rethrow the exception. + 7. Unset traverser’s [active flag](https://dom.spec.whatwg.org/#concept-traversal-active). + 8. Return result. + ### 6.1. Interface `[NodeIterator](https://dom.spec.whatwg.org/#nodeiterator)`[](https://dom.spec.whatwg.org/#interface-nodeiterator) -[NodeIterator](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator 'The NodeIterator interface represents an iterator over the members of a list of the nodes in a subtree of the DOM. The nodes will be returned in document order.') +[NodeIterator](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator "The NodeIterator interface represents an iterator over the members of a list of the nodes in a subtree of the DOM. The nodes will be returned in document order.") In all current engines. Firefox3.5+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `NodeIterator` { -\[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [Node](https://dom.spec.whatwg.org/#node) [root](https://dom.spec.whatwg.org/#dom-nodeiterator-root); -readonly attribute [Node](https://dom.spec.whatwg.org/#node) [referenceNode](https://dom.spec.whatwg.org/#dom-nodeiterator-referencenode); -readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [pointerBeforeReferenceNode](https://dom.spec.whatwg.org/#dom-nodeiterator-pointerbeforereferencenode); -readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [whatToShow](https://dom.spec.whatwg.org/#dom-nodeiterator-whattoshow); -readonly attribute [NodeFilter](https://dom.spec.whatwg.org/#callbackdef-nodefilter)? [filter](https://dom.spec.whatwg.org/#dom-nodeiterator-filter); + \[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [Node](https://dom.spec.whatwg.org/#node) [root](https://dom.spec.whatwg.org/#dom-nodeiterator-root); + readonly attribute [Node](https://dom.spec.whatwg.org/#node) [referenceNode](https://dom.spec.whatwg.org/#dom-nodeiterator-referencenode); + readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [pointerBeforeReferenceNode](https://dom.spec.whatwg.org/#dom-nodeiterator-pointerbeforereferencenode); + readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [whatToShow](https://dom.spec.whatwg.org/#dom-nodeiterator-whattoshow); + readonly attribute [NodeFilter](https://dom.spec.whatwg.org/#callbackdef-nodefilter)? [filter](https://dom.spec.whatwg.org/#dom-nodeiterator-filter); -[Node](https://dom.spec.whatwg.org/#node)? [nextNode](https://dom.spec.whatwg.org/#dom-nodeiterator-nextnode)(); -[Node](https://dom.spec.whatwg.org/#node)? [previousNode](https://dom.spec.whatwg.org/#dom-nodeiterator-previousnode)(); + [Node](https://dom.spec.whatwg.org/#node)? [nextNode](https://dom.spec.whatwg.org/#dom-nodeiterator-nextnode)(); + [Node](https://dom.spec.whatwg.org/#node)? [previousNode](https://dom.spec.whatwg.org/#dom-nodeiterator-previousnode)(); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) [detach](https://dom.spec.whatwg.org/#dom-nodeiterator-detach)(); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [detach](https://dom.spec.whatwg.org/#dom-nodeiterator-detach)(); }; `[NodeIterator](https://dom.spec.whatwg.org/#nodeiterator)` objects can be created using the `[createNodeIterator()](https://dom.spec.whatwg.org/#dom-document-createnodeiterator)` method on `[Document](https://dom.spec.whatwg.org/#document)` objects. @@ -9694,113 +10342,117 @@ As mentioned earlier, `[NodeIterator](https://dom.spec.whatwg.org/#nodeiterator) The `NodeIterator` pre-removing steps given a nodeIterator and toBeRemovedNode, are as follows: 1. If toBeRemovedNode is not an [inclusive ancestor](https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor) of nodeIterator’s [reference](https://dom.spec.whatwg.org/#nodeiterator-reference), or toBeRemovedNode is nodeIterator’s [root](https://dom.spec.whatwg.org/#concept-traversal-root), then return. + 2. If nodeIterator’s [pointer before reference](https://dom.spec.whatwg.org/#nodeiterator-pointer-before-reference) is true, then: - + 1. Let next be toBeRemovedNode’s first [following](https://dom.spec.whatwg.org/#concept-tree-following) [node](https://dom.spec.whatwg.org/#concept-node) that is an [inclusive descendant](https://dom.spec.whatwg.org/#concept-tree-inclusive-descendant) of nodeIterator’s [root](https://dom.spec.whatwg.org/#concept-traversal-root) and is not an [inclusive descendant](https://dom.spec.whatwg.org/#concept-tree-inclusive-descendant) of toBeRemovedNode, and null if there is no such [node](https://dom.spec.whatwg.org/#concept-node). + 2. If next is non-null, then set nodeIterator’s [reference](https://dom.spec.whatwg.org/#nodeiterator-reference) to next and return. + 3. Otherwise, set nodeIterator’s [pointer before reference](https://dom.spec.whatwg.org/#nodeiterator-pointer-before-reference) to false. - + Steps are not terminated here. - + 3. Set nodeIterator’s [reference](https://dom.spec.whatwg.org/#nodeiterator-reference) to toBeRemovedNode’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent), if toBeRemovedNode’s [previous sibling](https://dom.spec.whatwg.org/#concept-tree-previous-sibling) is null, and to the [inclusive descendant](https://dom.spec.whatwg.org/#concept-tree-inclusive-descendant) of toBeRemovedNode’s [previous sibling](https://dom.spec.whatwg.org/#concept-tree-previous-sibling) that appears last in [tree order](https://dom.spec.whatwg.org/#concept-tree-order) otherwise. + ---- +___ -[NodeIterator/root](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/root 'The NodeIterator.root read-only property represents the Node that is the root of what the NodeIterator traverses.') +[NodeIterator/root](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/root "The NodeIterator.root read-only property represents the Node that is the root of what the NodeIterator traverses.") In all current engines. Firefox3.5+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `root` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [root](https://dom.spec.whatwg.org/#concept-traversal-root). -[NodeIterator/referenceNode](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/referenceNode 'The NodeIterator.referenceNode read-only 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.') +[NodeIterator/referenceNode](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/referenceNode "The NodeIterator.referenceNode read-only 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.") In all current engines. Firefox3.5+Safari3+Chrome1+ ---- +___ OperaYesEdge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera MobileYes The `referenceNode` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [reference](https://dom.spec.whatwg.org/#nodeiterator-reference). -[NodeIterator/pointerBeforeReferenceNode](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/pointerBeforeReferenceNode '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.') +[NodeIterator/pointerBeforeReferenceNode](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/pointerBeforeReferenceNode "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.") In all current engines. Firefox3.5+Safari3+Chrome1+ ---- +___ OperaYesEdge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera MobileYes The `pointerBeforeReferenceNode` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [pointer before reference](https://dom.spec.whatwg.org/#nodeiterator-pointer-before-reference). -[NodeIterator/whatToShow](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/whatToShow 'The NodeIterator.whatToShow read-only property represents an unsigned integer representing a bitmask signifying what types of nodes should be returned by the NodeIterator.') +[NodeIterator/whatToShow](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/whatToShow "The NodeIterator.whatToShow read-only property represents an unsigned integer representing a bitmask signifying what types of nodes should be returned by the NodeIterator.") In all current engines. Firefox3.5+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `whatToShow` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [whatToShow](https://dom.spec.whatwg.org/#concept-traversal-whattoshow). -[NodeIterator/filter](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/filter 'The NodeIterator.filter read-only method returns a NodeFilter object, that is an object implement an acceptNode(node) method, used to screen nodes.') +[NodeIterator/filter](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/filter "The NodeIterator.filter read-only method returns a NodeFilter object, that is an object implement an acceptNode(node) method, used to screen nodes.") In all current engines. Firefox3.5+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -9809,65 +10461,71 @@ The `filter` getter steps are to return [this](https://webidl.spec.whatwg.org/#t To traverse, given a `[NodeIterator](https://dom.spec.whatwg.org/#nodeiterator)` object iterator and a direction direction, run these steps: 1. Let node be iterator’s [reference](https://dom.spec.whatwg.org/#nodeiterator-reference). + 2. Let beforeNode be iterator’s [pointer before reference](https://dom.spec.whatwg.org/#nodeiterator-pointer-before-reference). + 3. While true: - + 1. Branch on direction: - + next - + If beforeNode is false, then set node to the first [node](https://dom.spec.whatwg.org/#concept-node) [following](https://dom.spec.whatwg.org/#concept-tree-following) node in iterator’s [iterator collection](https://dom.spec.whatwg.org/#iterator-collection). If there is no such [node](https://dom.spec.whatwg.org/#concept-node), then return null. - + If beforeNode is true, then set it to false. - + previous - + If beforeNode is true, then set node to the first [node](https://dom.spec.whatwg.org/#concept-node) [preceding](https://dom.spec.whatwg.org/#concept-tree-preceding) node in iterator’s [iterator collection](https://dom.spec.whatwg.org/#iterator-collection). If there is no such [node](https://dom.spec.whatwg.org/#concept-node), then return null. - + If beforeNode is false, then set it to true. - + 2. Let result be the result of [filtering](https://dom.spec.whatwg.org/#concept-node-filter) node within iterator. + 3. If result is `[FILTER_ACCEPT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_accept)`, then [break](https://infra.spec.whatwg.org/#iteration-break). - + 4. Set iterator’s [reference](https://dom.spec.whatwg.org/#nodeiterator-reference) to node. + 5. Set iterator’s [pointer before reference](https://dom.spec.whatwg.org/#nodeiterator-pointer-before-reference) to beforeNode. + 6. Return node. + -[NodeIterator/nextNode](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/nextNode '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.') +[NodeIterator/nextNode](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/nextNode "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.") In all current engines. Firefox3.5+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ The `nextNode()` method steps are to return the result of [traversing](https://dom.spec.whatwg.org/#concept-nodeiterator-traverse) with [this](https://webidl.spec.whatwg.org/#this) and next. -[NodeIterator/previousNode](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/previousNode '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.') +[NodeIterator/previousNode](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/previousNode "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.") In all current engines. Firefox3.5+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ @@ -9877,38 +10535,38 @@ The `detach()` method steps are to do nothing. Its functionality (disabling a `[ ### 6.2. Interface `[TreeWalker](https://dom.spec.whatwg.org/#treewalker)`[](https://dom.spec.whatwg.org/#interface-treewalker) -[TreeWalker](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker 'The TreeWalker object represents the nodes of a document subtree and a position within them.') +[TreeWalker](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker "The TreeWalker object represents the nodes of a document subtree and a position within them.") In all current engines. Firefox4+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera Mobile10.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `TreeWalker` { -\[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [Node](https://dom.spec.whatwg.org/#node) [root](https://dom.spec.whatwg.org/#dom-treewalker-root); -readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [whatToShow](https://dom.spec.whatwg.org/#dom-treewalker-whattoshow); -readonly attribute [NodeFilter](https://dom.spec.whatwg.org/#callbackdef-nodefilter)? [filter](https://dom.spec.whatwg.org/#dom-treewalker-filter); -attribute [Node](https://dom.spec.whatwg.org/#node) [currentNode](https://dom.spec.whatwg.org/#dom-treewalker-currentnode); - -[Node](https://dom.spec.whatwg.org/#node)? [parentNode](https://dom.spec.whatwg.org/#dom-treewalker-parentnode)(); -[Node](https://dom.spec.whatwg.org/#node)? [firstChild](https://dom.spec.whatwg.org/#dom-treewalker-firstchild)(); -[Node](https://dom.spec.whatwg.org/#node)? [lastChild](https://dom.spec.whatwg.org/#dom-treewalker-lastchild)(); -[Node](https://dom.spec.whatwg.org/#node)? [previousSibling](https://dom.spec.whatwg.org/#dom-treewalker-previoussibling)(); -[Node](https://dom.spec.whatwg.org/#node)? [nextSibling](https://dom.spec.whatwg.org/#dom-treewalker-nextsibling)(); -[Node](https://dom.spec.whatwg.org/#node)? [previousNode](https://dom.spec.whatwg.org/#dom-treewalker-previousnode)(); -[Node](https://dom.spec.whatwg.org/#node)? [nextNode](https://dom.spec.whatwg.org/#dom-treewalker-nextnode)(); + \[[SameObject](https://webidl.spec.whatwg.org/#SameObject)\] readonly attribute [Node](https://dom.spec.whatwg.org/#node) [root](https://dom.spec.whatwg.org/#dom-treewalker-root); + readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [whatToShow](https://dom.spec.whatwg.org/#dom-treewalker-whattoshow); + readonly attribute [NodeFilter](https://dom.spec.whatwg.org/#callbackdef-nodefilter)? [filter](https://dom.spec.whatwg.org/#dom-treewalker-filter); + attribute [Node](https://dom.spec.whatwg.org/#node) [currentNode](https://dom.spec.whatwg.org/#dom-treewalker-currentnode); + + [Node](https://dom.spec.whatwg.org/#node)? [parentNode](https://dom.spec.whatwg.org/#dom-treewalker-parentnode)(); + [Node](https://dom.spec.whatwg.org/#node)? [firstChild](https://dom.spec.whatwg.org/#dom-treewalker-firstchild)(); + [Node](https://dom.spec.whatwg.org/#node)? [lastChild](https://dom.spec.whatwg.org/#dom-treewalker-lastchild)(); + [Node](https://dom.spec.whatwg.org/#node)? [previousSibling](https://dom.spec.whatwg.org/#dom-treewalker-previoussibling)(); + [Node](https://dom.spec.whatwg.org/#node)? [nextSibling](https://dom.spec.whatwg.org/#dom-treewalker-nextsibling)(); + [Node](https://dom.spec.whatwg.org/#node)? [previousNode](https://dom.spec.whatwg.org/#dom-treewalker-previousnode)(); + [Node](https://dom.spec.whatwg.org/#node)? [nextNode](https://dom.spec.whatwg.org/#dom-treewalker-nextnode)(); }; `[TreeWalker](https://dom.spec.whatwg.org/#treewalker)` objects can be created using the `[createTreeWalker()](https://dom.spec.whatwg.org/#dom-document-createtreewalker)` method on `[Document](https://dom.spec.whatwg.org/#document)` objects. @@ -9917,61 +10575,61 @@ Each `[TreeWalker](https://dom.spec.whatwg.org/#treewalker)` object has an assoc As mentioned earlier `[TreeWalker](https://dom.spec.whatwg.org/#treewalker)` objects have an associated [root](https://dom.spec.whatwg.org/#concept-traversal-root), [whatToShow](https://dom.spec.whatwg.org/#concept-traversal-whattoshow), and [filter](https://dom.spec.whatwg.org/#concept-traversal-filter) as well. -[TreeWalker/root](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/root 'The TreeWalker.root read-only property returns the node that is the root of what the TreeWalker traverses.') +[TreeWalker/root](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/root "The TreeWalker.root read-only property returns the node that is the root of what the TreeWalker traverses.") In all current engines. Firefox4+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera Mobile10.1+ The `root` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [root](https://dom.spec.whatwg.org/#concept-traversal-root). -[TreeWalker/whatToShow](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/whatToShow 'The TreeWalker.whatToShow read-only property returns an unsigned long being a bitmask made of constants describing the types of Node that must to be presented. Non-matching nodes are skipped, but their children may be included, if relevant. The possible values are:') +[TreeWalker/whatToShow](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/whatToShow "The TreeWalker.whatToShow read-only property returns an unsigned long being a bitmask made of constants describing the types of Node that must to be presented. Non-matching nodes are skipped, but their children may be included, if relevant. The possible values are:") In all current engines. Firefox4+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera Mobile10.1+ The `whatToShow` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [whatToShow](https://dom.spec.whatwg.org/#concept-traversal-whattoshow). -[TreeWalker/filter](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/filter 'The TreeWalker.filter read-only property returns a NodeFilter that is the filtering object associated with the TreeWalker.') +[TreeWalker/filter](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/filter "The TreeWalker.filter read-only property returns a NodeFilter that is the filtering object associated with the TreeWalker.") In all current engines. Firefox4+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera Mobile10.1+ @@ -9979,27 +10637,27 @@ The `filter` getter steps are to return [this](https://webidl.spec.whatwg.org/#t The `currentNode` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s [current](https://dom.spec.whatwg.org/#treewalker-current). -[TreeWalker/currentNode](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/currentNode 'The TreeWalker.currentNode property represents the Node on which the TreeWalker is currently pointing at.') +[TreeWalker/currentNode](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/currentNode "The TreeWalker.currentNode property represents the Node on which the TreeWalker is currently pointing at.") In all current engines. Firefox4+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera Mobile10.1+ The `[currentNode](https://dom.spec.whatwg.org/#dom-treewalker-currentnode)` setter steps are to set [this](https://webidl.spec.whatwg.org/#this)’s [current](https://dom.spec.whatwg.org/#treewalker-current) to the given value. ---- +___ [TreeWalker/parentNode](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/parentNode "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, returns null and the current node is not changed.") @@ -10007,86 +10665,99 @@ In all current engines. Firefox4+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera Mobile10.1+ The `parentNode()` method steps are: 1. Let node be [this](https://webidl.spec.whatwg.org/#this)’s [current](https://dom.spec.whatwg.org/#treewalker-current). + 2. While node is non-null and is not [this](https://webidl.spec.whatwg.org/#this)’s [root](https://dom.spec.whatwg.org/#concept-traversal-root): - + 1. Set node to node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent). + 2. If node is non-null and [filtering](https://dom.spec.whatwg.org/#concept-node-filter) node within [this](https://webidl.spec.whatwg.org/#this) returns `[FILTER_ACCEPT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_accept)`, then set [this](https://webidl.spec.whatwg.org/#this)’s [current](https://dom.spec.whatwg.org/#treewalker-current) to node and return node. - + 3. Return null. + To traverse children, given a walker and type, run these steps: 1. Let node be walker’s [current](https://dom.spec.whatwg.org/#treewalker-current). + 2. Set node to node’s [first child](https://dom.spec.whatwg.org/#concept-tree-first-child) if type is first, and node’s [last child](https://dom.spec.whatwg.org/#concept-tree-last-child) if type is last. + 3. While node is non-null: - + 1. Let result be the result of [filtering](https://dom.spec.whatwg.org/#concept-node-filter) node within walker. + 2. If result is `[FILTER_ACCEPT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_accept)`, then set walker’s [current](https://dom.spec.whatwg.org/#treewalker-current) to node and return node. + 3. If result is `[FILTER_SKIP](https://dom.spec.whatwg.org/#dom-nodefilter-filter_skip)`, then: - + 1. Let child be node’s [first child](https://dom.spec.whatwg.org/#concept-tree-first-child) if type is first, and node’s [last child](https://dom.spec.whatwg.org/#concept-tree-last-child) if type is last. + 2. If child is non-null, then set node to child and [continue](https://infra.spec.whatwg.org/#iteration-continue). - + 4. While node is non-null: - + 1. Let sibling be node’s [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling) if type is first, and node’s [previous sibling](https://dom.spec.whatwg.org/#concept-tree-previous-sibling) if type is last. + 2. If sibling is non-null, then set node to sibling and [break](https://infra.spec.whatwg.org/#iteration-break). + 3. Let parent be node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent). + 4. If parent is null, walker’s [root](https://dom.spec.whatwg.org/#concept-traversal-root), or walker’s [current](https://dom.spec.whatwg.org/#treewalker-current), then return null. + 5. Set node to parent. - + 4. Return null. + -[TreeWalker/firstChild](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/firstChild 'The TreeWalker.firstChild() method moves the current Node to the first visible child of the current node, and returns the found child. It also moves the current node to this child. If no such child exists, returns null and the current node is not changed.') +[TreeWalker/firstChild](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/firstChild "The TreeWalker.firstChild() method moves the current Node to the first visible child of the current node, and returns the found child. It also moves the current node to this child. If no such child exists, returns null and the current node is not changed.") In all current engines. Firefox4+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera Mobile10.1+ The `firstChild()` method steps are to [traverse children](https://dom.spec.whatwg.org/#concept-traverse-children) with [this](https://webidl.spec.whatwg.org/#this) and first. -[TreeWalker/lastChild](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/lastChild 'The TreeWalker.lastChild() method moves the current Node to the last visible child of the current node, and returns the found child. It also moves the current node to this child. If no such child exists, returns null and the current node is not changed.') +[TreeWalker/lastChild](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/lastChild "The TreeWalker.lastChild() method moves the current Node to the last visible child of the current node, and returns the found child. It also moves the current node to this child. If no such child exists, returns null and the current node is not changed.") In all current engines. Firefox4+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera Mobile10.1+ @@ -10095,207 +10766,237 @@ The `lastChild()` method steps are to [traverse children](https://dom.spec.whatw To traverse siblings, given a walker and type, run these steps: 1. Let node be walker’s [current](https://dom.spec.whatwg.org/#treewalker-current). + 2. If node is [root](https://dom.spec.whatwg.org/#concept-traversal-root), then return null. + 3. While true: - + 1. Let sibling be node’s [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling) if type is next, and node’s [previous sibling](https://dom.spec.whatwg.org/#concept-tree-previous-sibling) if type is previous. + 2. While sibling is non-null: - + 1. Set node to sibling. + 2. Let result be the result of [filtering](https://dom.spec.whatwg.org/#concept-node-filter) node within walker. + 3. If result is `[FILTER_ACCEPT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_accept)`, then set walker’s [current](https://dom.spec.whatwg.org/#treewalker-current) to node and return node. + 4. Set sibling to node’s [first child](https://dom.spec.whatwg.org/#concept-tree-first-child) if type is next, and node’s [last child](https://dom.spec.whatwg.org/#concept-tree-last-child) if type is previous. + 5. If result is `[FILTER_REJECT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_reject)` or sibling is null, then set sibling to node’s [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling) if type is next, and node’s [previous sibling](https://dom.spec.whatwg.org/#concept-tree-previous-sibling) if type is previous. - + 3. Set node to node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent). + 4. If node is null or walker’s [root](https://dom.spec.whatwg.org/#concept-traversal-root), then return null. + 5. If the return value of [filtering](https://dom.spec.whatwg.org/#concept-node-filter) node within walker is `[FILTER_ACCEPT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_accept)`, then return null. + -[TreeWalker/nextSibling](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/nextSibling '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, return null and the current node is not changed.') +[TreeWalker/nextSibling](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/nextSibling "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, return null and the current node is not changed.") In all current engines. Firefox4+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera Mobile10.1+ The `nextSibling()` method steps are to [traverse siblings](https://dom.spec.whatwg.org/#concept-traverse-siblings) with [this](https://webidl.spec.whatwg.org/#this) and next. -[TreeWalker/previousSibling](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/previousSibling '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, return null and the current node is not changed.') +[TreeWalker/previousSibling](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/previousSibling "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, return null and the current node is not changed.") In all current engines. Firefox4+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera Mobile10.1+ The `previousSibling()` method steps are to [traverse siblings](https://dom.spec.whatwg.org/#concept-traverse-siblings) with [this](https://webidl.spec.whatwg.org/#this) and previous. -[TreeWalker/previousNode](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/previousNode 'The TreeWalker.previousNode() method moves the current Node to the previous visible node in the document order, and returns the found node. It also moves the current node to this one. If no such node exists,or if it is before that the root node defined at the object construction, returns null and the current node is not changed.') +[TreeWalker/previousNode](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/previousNode "The TreeWalker.previousNode() method moves the current Node to the previous visible node in the document order, and returns the found node. It also moves the current node to this one. If no such node exists,or if it is before that the root node defined at the object construction, returns null and the current node is not changed.") In all current engines. Firefox4+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera Mobile10.1+ The `previousNode()` method steps are: 1. Let node be [this](https://webidl.spec.whatwg.org/#this)’s [current](https://dom.spec.whatwg.org/#treewalker-current). + 2. While node is not [this](https://webidl.spec.whatwg.org/#this)’s [root](https://dom.spec.whatwg.org/#concept-traversal-root): - + 1. Let sibling be node’s [previous sibling](https://dom.spec.whatwg.org/#concept-tree-previous-sibling). + 2. While sibling is non-null: - + 1. Set node to sibling. + 2. Let result be the result of [filtering](https://dom.spec.whatwg.org/#concept-node-filter) node within [this](https://webidl.spec.whatwg.org/#this). + 3. While result is not `[FILTER_REJECT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_reject)` and node has a [child](https://dom.spec.whatwg.org/#concept-tree-child): - + 1. Set node to node’s [last child](https://dom.spec.whatwg.org/#concept-tree-last-child). + 2. Set result to the result of [filtering](https://dom.spec.whatwg.org/#concept-node-filter) node within [this](https://webidl.spec.whatwg.org/#this). - + 4. If result is `[FILTER_ACCEPT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_accept)`, then set [this](https://webidl.spec.whatwg.org/#this)’s [current](https://dom.spec.whatwg.org/#treewalker-current) to node and return node. + 5. Set sibling to node’s [previous sibling](https://dom.spec.whatwg.org/#concept-tree-previous-sibling). - + 3. If node is [this](https://webidl.spec.whatwg.org/#this)’s [root](https://dom.spec.whatwg.org/#concept-traversal-root) or node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is null, then return null. + 4. Set node to node’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent). + 5. If the return value of [filtering](https://dom.spec.whatwg.org/#concept-node-filter) node within [this](https://webidl.spec.whatwg.org/#this) is `[FILTER_ACCEPT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_accept)`, then set [this](https://webidl.spec.whatwg.org/#this)’s [current](https://dom.spec.whatwg.org/#treewalker-current) to node and return node. - + 3. Return null. + -[TreeWalker/nextNode](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/nextNode 'The TreeWalker.nextNode() method moves the current Node to the next visible node in the document order, and returns the found node. It also moves the current node to this one. If no such node exists, returns null and the current node is not changed.') +[TreeWalker/nextNode](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/nextNode "The TreeWalker.nextNode() method moves the current Node to the next visible node in the document order, and returns the found node. It also moves the current node to this one. If no such node exists, returns null and the current node is not changed.") In all current engines. Firefox4+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera Mobile10.1+ The `nextNode()` method steps are: 1. Let node be [this](https://webidl.spec.whatwg.org/#this)’s [current](https://dom.spec.whatwg.org/#treewalker-current). + 2. Let result be `[FILTER_ACCEPT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_accept)`. + 3. While true: - + 1. While result is not `[FILTER_REJECT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_reject)` and node has a [child](https://dom.spec.whatwg.org/#concept-tree-child): - + 1. Set node to its [first child](https://dom.spec.whatwg.org/#concept-tree-first-child). + 2. Set result to the result of [filtering](https://dom.spec.whatwg.org/#concept-node-filter) node within [this](https://webidl.spec.whatwg.org/#this). + 3. If result is `[FILTER_ACCEPT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_accept)`, then set [this](https://webidl.spec.whatwg.org/#this)’s [current](https://dom.spec.whatwg.org/#treewalker-current) to node and return node. - + 2. Let sibling be null. + 3. Let temporary be node. + 4. While temporary is non-null: - + 1. If temporary is [this](https://webidl.spec.whatwg.org/#this)’s [root](https://dom.spec.whatwg.org/#concept-traversal-root), then return null. + 2. Set sibling to temporary’s [next sibling](https://dom.spec.whatwg.org/#concept-tree-next-sibling). + 3. If sibling is non-null, then set node to sibling and [break](https://infra.spec.whatwg.org/#iteration-break). + 4. Set temporary to temporary’s [parent](https://dom.spec.whatwg.org/#concept-tree-parent). - + 5. Set result to the result of [filtering](https://dom.spec.whatwg.org/#concept-node-filter) node within [this](https://webidl.spec.whatwg.org/#this). + 6. If result is `[FILTER_ACCEPT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_accept)`, then set [this](https://webidl.spec.whatwg.org/#this)’s [current](https://dom.spec.whatwg.org/#treewalker-current) to node and return node. + ### 6.3. Interface `[NodeFilter](https://dom.spec.whatwg.org/#callbackdef-nodefilter)`[](https://dom.spec.whatwg.org/#interface-nodefilter) -[NodeFilter](https://developer.mozilla.org/en-US/docs/Web/API/NodeFilter 'A NodeFilter interface represents an object used to filter the nodes in a NodeIterator or TreeWalker. A NodeFilter knows nothing about the document or traversing nodes; it only knows how to evaluate a single node against the provided filter.') +[NodeFilter](https://developer.mozilla.org/en-US/docs/Web/API/NodeFilter "A NodeFilter interface represents an object used to filter the nodes in a NodeIterator or TreeWalker. A NodeFilter knows nothing about the document or traversing nodes; it only knows how to evaluate a single node against the provided filter.") In all current engines. Firefox2+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ -[NodeFilter/acceptNode](https://developer.mozilla.org/en-US/docs/Web/API/NodeFilter/acceptNode 'The NodeFilter.acceptNode() method returns an unsigned short that will be used to tell if a given Node must be accepted or not by the NodeIterator or TreeWalker iteration algorithm. This method is expected to be written by the user of a NodeFilter. Possible return values are:') +[NodeFilter/acceptNode](https://developer.mozilla.org/en-US/docs/Web/API/NodeFilter/acceptNode "The NodeFilter.acceptNode() method returns an unsigned short that will be used to tell if a given Node must be accepted or not by the NodeIterator or TreeWalker iteration algorithm. This method is expected to be written by the user of a NodeFilter. Possible return values are:") In all current engines. Firefox2+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IE9+ ---- +___ Firefox for Android4+iOS Safari3+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] callback interface `NodeFilter` { -// Constants for acceptNode() -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [FILTER_ACCEPT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_accept) = 1; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [FILTER_REJECT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_reject) = 2; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [FILTER_SKIP](https://dom.spec.whatwg.org/#dom-nodefilter-filter_skip) = 3; - -// Constants for whatToShow -const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW_ALL](https://dom.spec.whatwg.org/#dom-nodefilter-show_all) = 0xFFFFFFFF; -const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW_ELEMENT](https://dom.spec.whatwg.org/#dom-nodefilter-show_element) = 0x1; -const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW_ATTRIBUTE](https://dom.spec.whatwg.org/#dom-nodefilter-show_attribute) = 0x2; -const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW_TEXT](https://dom.spec.whatwg.org/#dom-nodefilter-show_text) = 0x4; -const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW_CDATA_SECTION](https://dom.spec.whatwg.org/#dom-nodefilter-show_cdata_section) = 0x8; -const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `SHOW_ENTITY_REFERENCE`[](https://dom.spec.whatwg.org/#dom-nodefilter-show_entity_reference) = 0x10; // legacy -const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `SHOW_ENTITY`[](https://dom.spec.whatwg.org/#dom-nodefilter-show_entity) = 0x20; // legacy -const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW_PROCESSING_INSTRUCTION](https://dom.spec.whatwg.org/#dom-nodefilter-show_processing_instruction) = 0x40; -const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW_COMMENT](https://dom.spec.whatwg.org/#dom-nodefilter-show_comment) = 0x80; -const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW_DOCUMENT](https://dom.spec.whatwg.org/#dom-nodefilter-show_document) = 0x100; -const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW_DOCUMENT_TYPE](https://dom.spec.whatwg.org/#dom-nodefilter-show_document_type) = 0x200; -const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW_DOCUMENT_FRAGMENT](https://dom.spec.whatwg.org/#dom-nodefilter-show_document_fragment) = 0x400; -const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `SHOW_NOTATION`[](https://dom.spec.whatwg.org/#dom-nodefilter-show_notation) = 0x800; // legacy - -[unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `acceptNode`[](https://dom.spec.whatwg.org/#dom-nodefilter-acceptnode)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-nodefilter-acceptnode-node-node)); + // Constants for acceptNode() + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [FILTER\_ACCEPT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_accept) = 1; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [FILTER\_REJECT](https://dom.spec.whatwg.org/#dom-nodefilter-filter_reject) = 2; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) [FILTER\_SKIP](https://dom.spec.whatwg.org/#dom-nodefilter-filter_skip) = 3; + + // Constants for whatToShow + const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW\_ALL](https://dom.spec.whatwg.org/#dom-nodefilter-show_all) = 0xFFFFFFFF; + const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW\_ELEMENT](https://dom.spec.whatwg.org/#dom-nodefilter-show_element) = 0x1; + const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW\_ATTRIBUTE](https://dom.spec.whatwg.org/#dom-nodefilter-show_attribute) = 0x2; + const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW\_TEXT](https://dom.spec.whatwg.org/#dom-nodefilter-show_text) = 0x4; + const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW\_CDATA\_SECTION](https://dom.spec.whatwg.org/#dom-nodefilter-show_cdata_section) = 0x8; + const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `SHOW_ENTITY_REFERENCE`[](https://dom.spec.whatwg.org/#dom-nodefilter-show_entity_reference) = 0x10; // legacy + const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `SHOW_ENTITY`[](https://dom.spec.whatwg.org/#dom-nodefilter-show_entity) = 0x20; // legacy + const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW\_PROCESSING\_INSTRUCTION](https://dom.spec.whatwg.org/#dom-nodefilter-show_processing_instruction) = 0x40; + const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW\_COMMENT](https://dom.spec.whatwg.org/#dom-nodefilter-show_comment) = 0x80; + const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW\_DOCUMENT](https://dom.spec.whatwg.org/#dom-nodefilter-show_document) = 0x100; + const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW\_DOCUMENT\_TYPE](https://dom.spec.whatwg.org/#dom-nodefilter-show_document_type) = 0x200; + const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [SHOW\_DOCUMENT\_FRAGMENT](https://dom.spec.whatwg.org/#dom-nodefilter-show_document_fragment) = 0x400; + const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `SHOW_NOTATION`[](https://dom.spec.whatwg.org/#dom-nodefilter-show_notation) = 0x800; // legacy + + [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `acceptNode`[](https://dom.spec.whatwg.org/#dom-nodefilter-acceptnode)([Node](https://dom.spec.whatwg.org/#node) `node`[](https://dom.spec.whatwg.org/#dom-nodefilter-acceptnode-node-node)); }; `[NodeFilter](https://dom.spec.whatwg.org/#callbackdef-nodefilter)` objects can be used as [filter](https://dom.spec.whatwg.org/#concept-traversal-filter) for `[NodeIterator](https://dom.spec.whatwg.org/#nodeiterator)` and `[TreeWalker](https://dom.spec.whatwg.org/#treewalker)` objects and also provide constants for their [whatToShow](https://dom.spec.whatwg.org/#concept-traversal-whattoshow) bitmask. A `[NodeFilter](https://dom.spec.whatwg.org/#callbackdef-nodefilter)` object is typically implemented as a JavaScript function. @@ -10325,36 +11026,36 @@ Yes, the name `[DOMTokenList](https://dom.spec.whatwg.org/#domtokenlist)` is an ### 7.1. Interface `[DOMTokenList](https://dom.spec.whatwg.org/#domtokenlist)`[](https://dom.spec.whatwg.org/#interface-domtokenlist) -[DOMTokenList](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList 'The DOMTokenList interface represents a set of space-separated tokens. Such a set is returned by Element.classList, HTMLLinkElement.relList, HTMLAnchorElement.relList, HTMLAreaElement.relList, HTMLIframeElement.sandbox, or HTMLOutputElement.htmlFor. It is indexed beginning with 0 as with JavaScript Array objects. DOMTokenList is always case-sensitive.') +[DOMTokenList](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList "The DOMTokenList interface represents a set of space-separated tokens. Such a set is returned by Element.classList, HTMLLinkElement.relList, HTMLAnchorElement.relList, HTMLAreaElement.relList, HTMLIframeElement.sandbox, or HTMLOutputElement.htmlFor. It is indexed beginning with 0 as with JavaScript Array objects. DOMTokenList is always case-sensitive.") In all current engines. Firefox3.6+Safari6+Chrome8+ ---- +___ Opera11.5+Edge79+ ---- +___ Edge (Legacy)12+IE10+ ---- +___ Firefox for Android4+iOS Safari6+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera Mobile11.5+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `DOMTokenList` { -readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [length](https://dom.spec.whatwg.org/#dom-domtokenlist-length); -getter [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [item](https://dom.spec.whatwg.org/#dom-domtokenlist-item)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `index`[](https://dom.spec.whatwg.org/#dom-domtokenlist-item-index-index)); -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [contains](https://dom.spec.whatwg.org/#dom-domtokenlist-contains)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `token`[](https://dom.spec.whatwg.org/#dom-domtokenlist-contains-token-token)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [add](https://dom.spec.whatwg.org/#dom-domtokenlist-add)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)... `tokens`[](https://dom.spec.whatwg.org/#dom-domtokenlist-add-tokens-tokens)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [remove](https://dom.spec.whatwg.org/#dom-domtokenlist-remove)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)... `tokens`[](https://dom.spec.whatwg.org/#dom-domtokenlist-remove-tokens-tokens)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [toggle](https://dom.spec.whatwg.org/#dom-domtokenlist-toggle)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `token`[](https://dom.spec.whatwg.org/#dom-domtokenlist-toggle-token-force-token), optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `force`[](https://dom.spec.whatwg.org/#dom-domtokenlist-toggle-token-force-force)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [replace](https://dom.spec.whatwg.org/#dom-domtokenlist-replace)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `token`[](https://dom.spec.whatwg.org/#dom-domtokenlist-replace-token-newtoken-token), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `newToken`[](https://dom.spec.whatwg.org/#dom-domtokenlist-replace-token-newtoken-newtoken)); -[boolean](https://webidl.spec.whatwg.org/#idl-boolean) [supports](https://dom.spec.whatwg.org/#dom-domtokenlist-supports)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `token`[](https://dom.spec.whatwg.org/#dom-domtokenlist-supports-token-token)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] stringifier[](https://dom.spec.whatwg.org/#DOMTokenList-stringification-behavior) attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [value](https://dom.spec.whatwg.org/#dom-domtokenlist-value); -iterable<[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)\>; + readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) [length](https://dom.spec.whatwg.org/#dom-domtokenlist-length); + getter [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? [item](https://dom.spec.whatwg.org/#dom-domtokenlist-item)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `index`[](https://dom.spec.whatwg.org/#dom-domtokenlist-item-index-index)); + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [contains](https://dom.spec.whatwg.org/#dom-domtokenlist-contains)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `token`[](https://dom.spec.whatwg.org/#dom-domtokenlist-contains-token-token)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [add](https://dom.spec.whatwg.org/#dom-domtokenlist-add)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)... `tokens`[](https://dom.spec.whatwg.org/#dom-domtokenlist-add-tokens-tokens)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) [remove](https://dom.spec.whatwg.org/#dom-domtokenlist-remove)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)... `tokens`[](https://dom.spec.whatwg.org/#dom-domtokenlist-remove-tokens-tokens)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [toggle](https://dom.spec.whatwg.org/#dom-domtokenlist-toggle)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `token`[](https://dom.spec.whatwg.org/#dom-domtokenlist-toggle-token-force-token), optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `force`[](https://dom.spec.whatwg.org/#dom-domtokenlist-toggle-token-force-force)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [replace](https://dom.spec.whatwg.org/#dom-domtokenlist-replace)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `token`[](https://dom.spec.whatwg.org/#dom-domtokenlist-replace-token-newtoken-token), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `newToken`[](https://dom.spec.whatwg.org/#dom-domtokenlist-replace-token-newtoken-newtoken)); + [boolean](https://webidl.spec.whatwg.org/#idl-boolean) [supports](https://dom.spec.whatwg.org/#dom-domtokenlist-supports)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `token`[](https://dom.spec.whatwg.org/#dom-domtokenlist-supports-token-token)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] stringifier[](https://dom.spec.whatwg.org/#DOMTokenList-stringification-behavior) attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) [value](https://dom.spec.whatwg.org/#dom-domtokenlist-value); + iterable<[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)\>; }; A `[DOMTokenList](https://dom.spec.whatwg.org/#domtokenlist)` object has an associated token set (a [set](https://infra.spec.whatwg.org/#ordered-set)), which is initially empty. @@ -10366,114 +11067,126 @@ A `[DOMTokenList](https://dom.spec.whatwg.org/#domtokenlist)` object also has an A `[DOMTokenList](https://dom.spec.whatwg.org/#domtokenlist)` object’s validation steps for a given token are: 1. If the associated [attribute](https://dom.spec.whatwg.org/#concept-attribute)’s [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) does not define [supported tokens](https://dom.spec.whatwg.org/#concept-supported-tokens), [throw](https://webidl.spec.whatwg.org/#dfn-throw) a `TypeError`. + 2. Let lowercase token be a copy of token, in [ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase). + 3. If lowercase token is present in [supported tokens](https://dom.spec.whatwg.org/#concept-supported-tokens), return true. + 4. Return false. + A `[DOMTokenList](https://dom.spec.whatwg.org/#domtokenlist)` object’s update steps are: 1. If the associated [element](https://dom.spec.whatwg.org/#concept-element) does not have an associated [attribute](https://dom.spec.whatwg.org/#concept-attribute) and [token set](https://dom.spec.whatwg.org/#concept-dtl-tokens) is empty, then return. + 2. [Set an attribute value](https://dom.spec.whatwg.org/#concept-element-attributes-set-value) for the associated [element](https://dom.spec.whatwg.org/#concept-element) using associated [attribute](https://dom.spec.whatwg.org/#concept-attribute)’s [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name) and the result of running the [ordered set serializer](https://dom.spec.whatwg.org/#concept-ordered-set-serializer) for [token set](https://dom.spec.whatwg.org/#concept-dtl-tokens). + A `[DOMTokenList](https://dom.spec.whatwg.org/#domtokenlist)` object’s serialize steps are to return the result of running [get an attribute value](https://dom.spec.whatwg.org/#concept-element-attributes-get-value) given the associated [element](https://dom.spec.whatwg.org/#concept-element) and the associated [attribute](https://dom.spec.whatwg.org/#concept-attribute)’s [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name). ---- +___ A `[DOMTokenList](https://dom.spec.whatwg.org/#domtokenlist)` object has these [attribute change steps](https://dom.spec.whatwg.org/#concept-element-attributes-change-ext) for its associated [element](https://dom.spec.whatwg.org/#concept-element): 1. If localName is associated attribute’s [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name), namespace is null, and value is null, then [empty](https://infra.spec.whatwg.org/#list-empty) [token set](https://dom.spec.whatwg.org/#concept-dtl-tokens). + 2. Otherwise, if localName is associated attribute’s [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name), namespace is null, then set [token set](https://dom.spec.whatwg.org/#concept-dtl-tokens) to value, [parsed](https://dom.spec.whatwg.org/#concept-ordered-set-parser). + When a `[DOMTokenList](https://dom.spec.whatwg.org/#domtokenlist)` object is created, then: 1. Let element be associated [element](https://dom.spec.whatwg.org/#concept-element). + 2. Let localName be associated attribute’s [local name](https://dom.spec.whatwg.org/#concept-attribute-local-name). + 3. Let value be the result of [getting an attribute value](https://dom.spec.whatwg.org/#concept-element-attributes-get-value) given element and localName. + 4. Run the [attribute change steps](https://dom.spec.whatwg.org/#concept-element-attributes-change-ext) for element, localName, value, value, and null. + -[DOMTokenList/length](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/length 'The length read-only property of the DOMTokenList interface is an integer representing the number of objects stored in the object.') +[DOMTokenList/length](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/length "The length read-only property of the DOMTokenList interface is an integer representing the number of objects stored in the object.") In all current engines. Firefox50+Safari6+Chrome8+ ---- +___ OperaYesEdge79+ ---- +___ Edge (Legacy)12+IE10+ ---- +___ Firefox for Android50+iOS Safari6+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera MobileYes -`` tokenlist . `[length](https://dom.spec.whatwg.org/#dom-domtokenlist-length)` `` +``tokenlist . `[length](https://dom.spec.whatwg.org/#dom-domtokenlist-length)` `` Returns the number of tokens. -[DOMTokenList/item](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/item 'The item() method of the DOMTokenList interface returns an item in the list by its index.') +[DOMTokenList/item](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/item "The item() method of the DOMTokenList interface returns an item in the list by its index.") In all current engines. Firefox3.6+Safari6+Chrome8+ ---- +___ OperaYesEdge79+ ---- +___ Edge (Legacy)12+IE10+ ---- +___ Firefox for Android4+iOS Safari6+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera MobileYes -`` tokenlist . `[item(index)](https://dom.spec.whatwg.org/#dom-domtokenlist-item)` `` +``tokenlist . `[item(index)](https://dom.spec.whatwg.org/#dom-domtokenlist-item)` `` `tokenlist[index]` Returns the token with index index. -[DOMTokenList/contains](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/contains 'The contains() method of the DOMTokenList interface returns a boolean value — true if the underlying list contains the given token, otherwise false.') +[DOMTokenList/contains](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/contains "The contains() method of the DOMTokenList interface returns a boolean value — true if the underlying list contains the given token, otherwise false.") In all current engines. Firefox3.6+Safari6+Chrome8+ ---- +___ OperaYesEdge79+ ---- +___ Edge (Legacy)12+IE10+ ---- +___ Firefox for Android4+iOS Safari6+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera MobileYes -`` tokenlist . `[contains(token)](https://dom.spec.whatwg.org/#dom-domtokenlist-contains)` `` +``tokenlist . `[contains(token)](https://dom.spec.whatwg.org/#dom-domtokenlist-contains)` `` Returns true if token is present; otherwise false. -[DOMTokenList/add](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add 'The add() method of the DOMTokenList interface adds the given token to the list.') +[DOMTokenList/add](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add "The add() method of the DOMTokenList interface adds the given token to the list.") In all current engines. Firefox3.6+Safari6+Chrome8+ ---- +___ OperaYesEdge79+ ---- +___ Edge (Legacy)12+IE10+ ---- +___ Firefox for Android4+iOS Safari6+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera MobileYes @@ -10485,21 +11198,21 @@ Throws a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`" `[DOMExc Throws an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if one of the arguments contains any [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace). -[DOMTokenList/remove](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/remove 'The remove() method of the DOMTokenList interface removes the specified tokens from the list.') +[DOMTokenList/remove](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/remove "The remove() method of the DOMTokenList interface removes the specified tokens from the list.") In all current engines. Firefox3.6+Safari6+Chrome8+ ---- +___ OperaYesEdge79+ ---- +___ Edge (Legacy)12+IE10+ ---- +___ Firefox for Android4+iOS Safari6+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera MobileYes @@ -10517,15 +11230,15 @@ In all current engines. Firefox3.6+Safari6+Chrome8+ ---- +___ OperaYesEdge79+ ---- +___ Edge (Legacy)12+IE10+ ---- +___ Firefox for Android4+iOS Safari6+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera MobileYes @@ -10545,15 +11258,15 @@ In all current engines. Firefox49+Safari10.1+Chrome61+ ---- +___ Opera48+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10.3+Chrome for Android61+Android WebView61+Samsung Internet8.0+Opera Mobile45+ @@ -10573,15 +11286,15 @@ In all current engines. Firefox49+Safari10.1+Chrome49+ ---- +___ Opera36+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android49+iOS Safari10.3+Chrome for Android49+Android WebView49+Samsung Internet5.0+Opera Mobile36+ @@ -10591,25 +11304,25 @@ Returns true if token is in the associated attribute’s supported tokens. Retur Throws a `TypeError` if the associated attribute has no supported tokens defined. -[DOMTokenList/value](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/value 'The value property of the DOMTokenList interface is a stringifier that returns the value of the list as a DOMString, or clears and sets the list to the given value.') +[DOMTokenList/value](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/value "The value property of the DOMTokenList interface is a stringifier that returns the value of the list as a DOMString, or clears and sets the list to the given value.") In all current engines. Firefox47+Safari10+Chrome50+ ---- +___ Opera37+Edge79+ ---- +___ Edge (Legacy)17+IENone ---- +___ Firefox for Android47+iOS Safari10+Chrome for Android50+Android WebView50+Samsung Internet5.0+Opera Mobile37+ -`` tokenlist . `[value](https://dom.spec.whatwg.org/#dom-domtokenlist-value)` `` +``tokenlist . `[value](https://dom.spec.whatwg.org/#dom-domtokenlist-value)` `` Returns the associated set as string. @@ -10622,59 +11335,80 @@ The object’s [supported property indices](https://webidl.spec.whatwg.org/#dfn- The `item(index)` method steps are: 1. If index is equal to or greater than [this](https://webidl.spec.whatwg.org/#this)’s [token set](https://dom.spec.whatwg.org/#concept-dtl-tokens)’s [size](https://infra.spec.whatwg.org/#list-size), then return null. + 2. Return [this](https://webidl.spec.whatwg.org/#this)’s [token set](https://dom.spec.whatwg.org/#concept-dtl-tokens)\[index\]. + The `contains(token)` method steps are to return true if [this](https://webidl.spec.whatwg.org/#this)’s [token set](https://dom.spec.whatwg.org/#concept-dtl-tokens)\[token\] [exists](https://infra.spec.whatwg.org/#list-contain); otherwise false. The `add(tokens…)` method steps are: 1. [For each](https://infra.spec.whatwg.org/#list-iterate) token in tokens: - + 1. If token is the empty string, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. If token contains any [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. - + 2. [For each](https://infra.spec.whatwg.org/#list-iterate) token in tokens, [append](https://infra.spec.whatwg.org/#set-append) token to [this](https://webidl.spec.whatwg.org/#this)’s [token set](https://dom.spec.whatwg.org/#concept-dtl-tokens). + 3. Run the [update steps](https://dom.spec.whatwg.org/#concept-dtl-update). + The `remove(tokens…)` method steps are: 1. [For each](https://infra.spec.whatwg.org/#list-iterate) token in tokens: - + 1. If token is the empty string, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. If token contains any [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. - + 2. For each token in tokens, [remove](https://infra.spec.whatwg.org/#list-remove) token from [this](https://webidl.spec.whatwg.org/#this)’s [token set](https://dom.spec.whatwg.org/#concept-dtl-tokens). + 3. Run the [update steps](https://dom.spec.whatwg.org/#concept-dtl-update). + The `toggle(token, force)` method steps are: 1. If token is the empty string, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. If token contains any [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 3. If [this](https://webidl.spec.whatwg.org/#this)’s [token set](https://dom.spec.whatwg.org/#concept-dtl-tokens)\[token\] [exists](https://infra.spec.whatwg.org/#list-contain), then: - + 1. If force is either not given or is false, then [remove](https://infra.spec.whatwg.org/#list-remove) token from [this](https://webidl.spec.whatwg.org/#this)’s [token set](https://dom.spec.whatwg.org/#concept-dtl-tokens), run the [update steps](https://dom.spec.whatwg.org/#concept-dtl-update) and return false. + 2. Return true. - + 4. Otherwise, if force not given or is true, [append](https://infra.spec.whatwg.org/#set-append) token to [this](https://webidl.spec.whatwg.org/#this)’s [token set](https://dom.spec.whatwg.org/#concept-dtl-tokens), run the [update steps](https://dom.spec.whatwg.org/#concept-dtl-update), and return true. + 5. Return false. + The [update steps](https://dom.spec.whatwg.org/#concept-dtl-update) are not always run for `[toggle()](https://dom.spec.whatwg.org/#dom-domtokenlist-toggle)` for web compatibility. The `replace(token, newToken)` method steps are: 1. If either token or newToken is the empty string, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 2. If either token or newToken contains any [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. + 3. If [this](https://webidl.spec.whatwg.org/#this)’s [token set](https://dom.spec.whatwg.org/#concept-dtl-tokens) does not [contain](https://infra.spec.whatwg.org/#list-contain) token, then return false. + 4. [Replace](https://infra.spec.whatwg.org/#set-replace) token in [this](https://webidl.spec.whatwg.org/#this)’s [token set](https://dom.spec.whatwg.org/#concept-dtl-tokens) with newToken. + 5. Run the [update steps](https://dom.spec.whatwg.org/#concept-dtl-update). + 6. Return true. + The [update steps](https://dom.spec.whatwg.org/#concept-dtl-update) are not always run for `[replace()](https://dom.spec.whatwg.org/#dom-domtokenlist-replace)` for web compatibility. The `supports(token)` method steps are: 1. Let result be the return value of [validation steps](https://dom.spec.whatwg.org/#concept-domtokenlist-validation) called with token. + 2. Return result. + The `value` attribute must return the result of running [this](https://webidl.spec.whatwg.org/#this)’s [serialize steps](https://dom.spec.whatwg.org/#concept-dtl-serialize). @@ -10686,400 +11420,400 @@ DOM Level 3 XPath defined an API for evaluating XPath 1.0 expressions. These API ### 8.1. Interface `[XPathResult](https://dom.spec.whatwg.org/#xpathresult)`[](https://dom.spec.whatwg.org/#interface-xpathresult) -[XPathResult](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult 'The XPathResult interface represents the results generated by evaluating an XPath expression within the context of a given node.') +[XPathResult](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult "The XPathResult interface represents the results generated by evaluating an XPath expression within the context of a given node.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -[XPathResult/booleanValue](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/booleanValue 'The read-only booleanValue property of the XPathResult interface returns the boolean value of a result with XPathResult.resultType being BOOLEAN_TYPE.') +[XPathResult/booleanValue](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/booleanValue "The read-only booleanValue property of the XPathResult interface returns the boolean value of a result with XPathResult.resultType being BOOLEAN_TYPE.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -[XPathResult/invalidIteratorState](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/invalidIteratorState 'The read-only invalidIteratorState property of the XPathResult interface signifies that the iterator has become invalid. It is true if XPathResult.resultType is UNORDERED_NODE_ITERATOR_TYPE or ORDERED_NODE_ITERATOR_TYPE and the document has been modified since this result was returned.') +[XPathResult/invalidIteratorState](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/invalidIteratorState "The read-only invalidIteratorState property of the XPathResult interface signifies that the iterator has become invalid. It is true if XPathResult.resultType is UNORDERED_NODE_ITERATOR_TYPE or ORDERED_NODE_ITERATOR_TYPE and the document has been modified since this result was returned.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera15+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile14+ -[XPathResult/iterateNext](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/iterateNext 'The iterateNext() method of the XPathResult interface iterates over a node set result and returns the next node from it or null if there are no more nodes.') +[XPathResult/iterateNext](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/iterateNext "The iterateNext() method of the XPathResult interface iterates over a node set result and returns the next node from it or null if there are no more nodes.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -[XPathResult/numberValue](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/numberValue 'The read-only numberValue property of the XPathResult interface returns the numeric value of a result with XPathResult.resultType being NUMBER_TYPE.') +[XPathResult/numberValue](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/numberValue "The read-only numberValue property of the XPathResult interface returns the numeric value of a result with XPathResult.resultType being NUMBER_TYPE.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -[XPathResult/resultType](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/resultType 'The read-only resultType property of the XPathResult interface represents the type of the result, as defined by the type constants.') +[XPathResult/resultType](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/resultType "The read-only resultType property of the XPathResult interface represents the type of the result, as defined by the type constants.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera15+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile14+ -[XPathResult/singleNodeValue](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/singleNodeValue 'The read-only singleNodeValue property of the XPathResult interface returns a Node value or null in case no node was matched of a result with XPathResult.resultType being ANY_UNORDERED_NODE_TYPE or FIRST_ORDERED_NODE_TYPE.') +[XPathResult/singleNodeValue](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/singleNodeValue "The read-only singleNodeValue property of the XPathResult interface returns a Node value or null in case no node was matched of a result with XPathResult.resultType being ANY_UNORDERED_NODE_TYPE or FIRST_ORDERED_NODE_TYPE.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -[XPathResult/snapshotItem](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/snapshotItem 'The snapshotItem() method of the XPathResult interface returns an item of the snapshot collection or null in case the index is not within the range of nodes. Unlike the iterator result, the snapshot does not become invalid, but may not correspond to the current document if it is mutated.') +[XPathResult/snapshotItem](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/snapshotItem "The snapshotItem() method of the XPathResult interface returns an item of the snapshot collection or null in case the index is not within the range of nodes. Unlike the iterator result, the snapshot does not become invalid, but may not correspond to the current document if it is mutated.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -[XPathResult/snapshotLength](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/snapshotLength 'The read-only snapshotLength property of the XPathResult interface represents the number of nodes in the result snapshot.') +[XPathResult/snapshotLength](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/snapshotLength "The read-only snapshotLength property of the XPathResult interface represents the number of nodes in the result snapshot.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -[XPathResult/stringValue](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/stringValue 'The read-only stringValue property of the XPathResult interface returns the string value of a result with XPathResult.resultType being STRING_TYPE.') +[XPathResult/stringValue](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/stringValue "The read-only stringValue property of the XPathResult interface returns the string value of a result with XPathResult.resultType being STRING_TYPE.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `XPathResult` { -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ANY_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-any_type) = 0; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `NUMBER_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-number_type) = 1; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `STRING_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-string_type) = 2; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `BOOLEAN_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-boolean_type) = 3; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `UNORDERED_NODE_ITERATOR_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-unordered_node_iterator_type) = 4; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ORDERED_NODE_ITERATOR_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-ordered_node_iterator_type) = 5; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `UNORDERED_NODE_SNAPSHOT_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-unordered_node_snapshot_type) = 6; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ORDERED_NODE_SNAPSHOT_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-ordered_node_snapshot_type) = 7; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ANY_UNORDERED_NODE_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-any_unordered_node_type) = 8; -const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `FIRST_ORDERED_NODE_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-first_ordered_node_type) = 9; - -readonly attribute [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `resultType`[](https://dom.spec.whatwg.org/#dom-xpathresult-resulttype); -readonly attribute [unrestricted double](https://webidl.spec.whatwg.org/#idl-unrestricted-double) `numberValue`[](https://dom.spec.whatwg.org/#dom-xpathresult-numbervalue); -readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `stringValue`[](https://dom.spec.whatwg.org/#dom-xpathresult-stringvalue); -readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `booleanValue`[](https://dom.spec.whatwg.org/#dom-xpathresult-booleanvalue); -readonly attribute [Node](https://dom.spec.whatwg.org/#node)? `singleNodeValue`[](https://dom.spec.whatwg.org/#dom-xpathresult-singlenodevalue); -readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `invalidIteratorState`[](https://dom.spec.whatwg.org/#dom-xpathresult-invaliditeratorstate); -readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `snapshotLength`[](https://dom.spec.whatwg.org/#dom-xpathresult-snapshotlength); - -[Node](https://dom.spec.whatwg.org/#node)? `iterateNext`[](https://dom.spec.whatwg.org/#dom-xpathresult-iteratenext)(); -[Node](https://dom.spec.whatwg.org/#node)? `snapshotItem`[](https://dom.spec.whatwg.org/#dom-xpathresult-snapshotitem)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `index`[](https://dom.spec.whatwg.org/#dom-xpathresult-snapshotitem-index-index)); + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ANY_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-any_type) = 0; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `NUMBER_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-number_type) = 1; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `STRING_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-string_type) = 2; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `BOOLEAN_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-boolean_type) = 3; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `UNORDERED_NODE_ITERATOR_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-unordered_node_iterator_type) = 4; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ORDERED_NODE_ITERATOR_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-ordered_node_iterator_type) = 5; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `UNORDERED_NODE_SNAPSHOT_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-unordered_node_snapshot_type) = 6; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ORDERED_NODE_SNAPSHOT_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-ordered_node_snapshot_type) = 7; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ANY_UNORDERED_NODE_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-any_unordered_node_type) = 8; + const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `FIRST_ORDERED_NODE_TYPE`[](https://dom.spec.whatwg.org/#dom-xpathresult-first_ordered_node_type) = 9; + + readonly attribute [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `resultType`[](https://dom.spec.whatwg.org/#dom-xpathresult-resulttype); + readonly attribute [unrestricted double](https://webidl.spec.whatwg.org/#idl-unrestricted-double) `numberValue`[](https://dom.spec.whatwg.org/#dom-xpathresult-numbervalue); + readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `stringValue`[](https://dom.spec.whatwg.org/#dom-xpathresult-stringvalue); + readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `booleanValue`[](https://dom.spec.whatwg.org/#dom-xpathresult-booleanvalue); + readonly attribute [Node](https://dom.spec.whatwg.org/#node)? `singleNodeValue`[](https://dom.spec.whatwg.org/#dom-xpathresult-singlenodevalue); + readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `invalidIteratorState`[](https://dom.spec.whatwg.org/#dom-xpathresult-invaliditeratorstate); + readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `snapshotLength`[](https://dom.spec.whatwg.org/#dom-xpathresult-snapshotlength); + + [Node](https://dom.spec.whatwg.org/#node)? `iterateNext`[](https://dom.spec.whatwg.org/#dom-xpathresult-iteratenext)(); + [Node](https://dom.spec.whatwg.org/#node)? `snapshotItem`[](https://dom.spec.whatwg.org/#dom-xpathresult-snapshotitem)([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `index`[](https://dom.spec.whatwg.org/#dom-xpathresult-snapshotitem-index-index)); }; ### 8.2. Interface `[XPathExpression](https://dom.spec.whatwg.org/#xpathexpression)`[](https://dom.spec.whatwg.org/#interface-xpathexpression) -[XPathExpression](https://developer.mozilla.org/en-US/docs/Web/API/XPathExpression 'This interface is a compiled XPath expression that can be evaluated on a document or specific node to return information from its DOM tree.') +[XPathExpression](https://developer.mozilla.org/en-US/docs/Web/API/XPathExpression "This interface is a compiled XPath expression that can be evaluated on a document or specific node to return information from its DOM tree.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -[XPathExpression/evaluate](https://developer.mozilla.org/en-US/docs/Web/API/XPathExpression/evaluate 'The evaluate() method of the XPathExpression interface executes an XPath expression on the given node or document and returns an XPathResult.') +[XPathExpression/evaluate](https://developer.mozilla.org/en-US/docs/Web/API/XPathExpression/evaluate "The evaluate() method of the XPathExpression interface executes an XPath expression on the given node or document and returns an XPathResult.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `XPathExpression` { -// XPathResult.ANY_TYPE = 0 -[XPathResult](https://dom.spec.whatwg.org/#xpathresult) `evaluate`[](https://dom.spec.whatwg.org/#dom-xpathexpression-evaluate)([Node](https://dom.spec.whatwg.org/#node) `contextNode`[](https://dom.spec.whatwg.org/#dom-xpathexpression-evaluate-contextnode-type-result-contextnode), optional [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `type`[](https://dom.spec.whatwg.org/#dom-xpathexpression-evaluate-contextnode-type-result-type) = 0, optional [XPathResult](https://dom.spec.whatwg.org/#xpathresult)? `result`[](https://dom.spec.whatwg.org/#dom-xpathexpression-evaluate-contextnode-type-result-result) = null); + // XPathResult.ANY\_TYPE = 0 + [XPathResult](https://dom.spec.whatwg.org/#xpathresult) `evaluate`[](https://dom.spec.whatwg.org/#dom-xpathexpression-evaluate)([Node](https://dom.spec.whatwg.org/#node) `contextNode`[](https://dom.spec.whatwg.org/#dom-xpathexpression-evaluate-contextnode-type-result-contextnode), optional [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `type`[](https://dom.spec.whatwg.org/#dom-xpathexpression-evaluate-contextnode-type-result-type) = 0, optional [XPathResult](https://dom.spec.whatwg.org/#xpathresult)? `result`[](https://dom.spec.whatwg.org/#dom-xpathexpression-evaluate-contextnode-type-result-result) = null); }; ### 8.3. Mixin `[XPathEvaluatorBase](https://dom.spec.whatwg.org/#xpathevaluatorbase)`[](https://dom.spec.whatwg.org/#mixin-xpathevaluatorbase) -[Document/createExpression](https://developer.mozilla.org/en-US/docs/Web/API/Document/createExpression 'This method compiles an XPathExpression which can then be used for (repeated) evaluations.') +[Document/createExpression](https://developer.mozilla.org/en-US/docs/Web/API/Document/createExpression "This method compiles an XPathExpression which can then be used for (repeated) evaluations.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile12.1+ -[XPathEvaluator/createExpression](https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator/createExpression 'This method compiles an XPathExpression which can then be used for (repeated) evaluations of the XPath expression.') +[XPathEvaluator/createExpression](https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator/createExpression "This method compiles an XPathExpression which can then be used for (repeated) evaluations of the XPath expression.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -[Document/createNSResolver](https://developer.mozilla.org/en-US/docs/Web/API/Document/createNSResolver 'Creates an XPathNSResolver which resolves namespaces with respect to the definitions in scope for a specified node.') +[Document/createNSResolver](https://developer.mozilla.org/en-US/docs/Web/API/Document/createNSResolver "Creates an XPathNSResolver which resolves namespaces with respect to the definitions in scope for a specified node.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile12.1+ -[XPathEvaluator/createNSResolver](https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator/createNSResolver 'This method adapts any DOM node to resolve namespaces so that an XPath expression can be easily evaluated relative to the context of the node where it appeared within the document.') +[XPathEvaluator/createNSResolver](https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator/createNSResolver "This method adapts any DOM node to resolve namespaces so that an XPath expression can be easily evaluated relative to the context of the node where it appeared within the document.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ -[Document/evaluate](https://developer.mozilla.org/en-US/docs/Web/API/Document/evaluate 'Returns an XPathResult based on an XPath expression and other given parameters.') +[Document/evaluate](https://developer.mozilla.org/en-US/docs/Web/API/Document/evaluate "Returns an XPathResult based on an XPath expression and other given parameters.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera9+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile10.1+ -[XPathEvaluator/evaluate](https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator/evaluate 'The evaluate() method of the XPathEvaluator interface executes an XPath expression on the given node or document and returns an XPathResult.') +[XPathEvaluator/evaluate](https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator/evaluate "The evaluate() method of the XPathEvaluator interface executes an XPath expression on the given node or document and returns an XPathResult.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ callback interface `XPathNSResolver` { -[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `lookupNamespaceURI`[](https://dom.spec.whatwg.org/#dom-xpathnsresolver-lookupnamespaceuri)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `prefix`[](https://dom.spec.whatwg.org/#dom-xpathnsresolver-lookupnamespaceuri-prefix-prefix)); + [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `lookupNamespaceURI`[](https://dom.spec.whatwg.org/#dom-xpathnsresolver-lookupnamespaceuri)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `prefix`[](https://dom.spec.whatwg.org/#dom-xpathnsresolver-lookupnamespaceuri-prefix-prefix)); }; interface mixin `XPathEvaluatorBase` { -\[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [XPathExpression](https://dom.spec.whatwg.org/#xpathexpression) `createExpression`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-createexpression)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `expression`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-createexpression-expression-resolver-expression), optional [XPathNSResolver](https://dom.spec.whatwg.org/#callbackdef-xpathnsresolver)? `resolver`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-createexpression-expression-resolver-resolver) = null); -[XPathNSResolver](https://dom.spec.whatwg.org/#callbackdef-xpathnsresolver) `createNSResolver`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-creatensresolver)([Node](https://dom.spec.whatwg.org/#node) `nodeResolver`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-creatensresolver-noderesolver-noderesolver)); -// XPathResult.ANY_TYPE = 0 -[XPathResult](https://dom.spec.whatwg.org/#xpathresult) `evaluate`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-evaluate)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `expression`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-evaluate-expression-contextnode-resolver-type-result-expression), [Node](https://dom.spec.whatwg.org/#node) `contextNode`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-evaluate-expression-contextnode-resolver-type-result-contextnode), optional [XPathNSResolver](https://dom.spec.whatwg.org/#callbackdef-xpathnsresolver)? `resolver`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-evaluate-expression-contextnode-resolver-type-result-resolver) = null, optional [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `type`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-evaluate-expression-contextnode-resolver-type-result-type) = 0, optional [XPathResult](https://dom.spec.whatwg.org/#xpathresult)? `result`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-evaluate-expression-contextnode-resolver-type-result-result) = null); + \[[NewObject](https://webidl.spec.whatwg.org/#NewObject)\] [XPathExpression](https://dom.spec.whatwg.org/#xpathexpression) `createExpression`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-createexpression)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `expression`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-createexpression-expression-resolver-expression), optional [XPathNSResolver](https://dom.spec.whatwg.org/#callbackdef-xpathnsresolver)? `resolver`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-createexpression-expression-resolver-resolver) = null); + [XPathNSResolver](https://dom.spec.whatwg.org/#callbackdef-xpathnsresolver) `createNSResolver`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-creatensresolver)([Node](https://dom.spec.whatwg.org/#node) `nodeResolver`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-creatensresolver-noderesolver-noderesolver)); + // XPathResult.ANY\_TYPE = 0 + [XPathResult](https://dom.spec.whatwg.org/#xpathresult) `evaluate`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-evaluate)([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `expression`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-evaluate-expression-contextnode-resolver-type-result-expression), [Node](https://dom.spec.whatwg.org/#node) `contextNode`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-evaluate-expression-contextnode-resolver-type-result-contextnode), optional [XPathNSResolver](https://dom.spec.whatwg.org/#callbackdef-xpathnsresolver)? `resolver`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-evaluate-expression-contextnode-resolver-type-result-resolver) = null, optional [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `type`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-evaluate-expression-contextnode-resolver-type-result-type) = 0, optional [XPathResult](https://dom.spec.whatwg.org/#xpathresult)? `result`[](https://dom.spec.whatwg.org/#dom-xpathevaluatorbase-evaluate-expression-contextnode-resolver-type-result-result) = null); }; [Document](https://dom.spec.whatwg.org/#document) includes [XPathEvaluatorBase](https://dom.spec.whatwg.org/#xpathevaluatorbase); ### 8.4. Interface `[XPathEvaluator](https://dom.spec.whatwg.org/#xpathevaluator)`[](https://dom.spec.whatwg.org/#interface-xpathevaluator) -[XPathEvaluator](https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator 'The XPathEvaluator interface allows to compile and evaluate XPath expressions.') +[XPathEvaluator](https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator "The XPathEvaluator interface allows to compile and evaluate XPath expressions.") In all current engines. Firefox1+Safari3+Chrome1+ ---- +___ Opera12.1+Edge79+ ---- +___ Edge (Legacy)12+IENone ---- +___ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+ \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `XPathEvaluator` { -`constructor`[](https://dom.spec.whatwg.org/#dom-xpathevaluator-xpathevaluator)(); + `constructor`[](https://dom.spec.whatwg.org/#dom-xpathevaluator-xpathevaluator)(); }; [XPathEvaluator](https://dom.spec.whatwg.org/#xpathevaluator) includes [XPathEvaluatorBase](https://dom.spec.whatwg.org/#xpathevaluatorbase); @@ -11094,15 +11828,15 @@ XSL Transformations (XSLT) is a language for transforming XML documents into oth \[[Exposed](https://webidl.spec.whatwg.org/#Exposed)\=Window\] interface `XSLTProcessor` { -`constructor`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-xsltprocessor)(); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) `importStylesheet`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-importstylesheet)([Node](https://dom.spec.whatwg.org/#node) `style`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-importstylesheet-style-style)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [DocumentFragment](https://dom.spec.whatwg.org/#documentfragment) `transformToFragment`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-transformtofragment)([Node](https://dom.spec.whatwg.org/#node) `source`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-transformtofragment-source-output-source), [Document](https://dom.spec.whatwg.org/#document) `output`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-transformtofragment-source-output-output)); -\[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Document](https://dom.spec.whatwg.org/#document) `transformToDocument`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-transformtodocument)([Node](https://dom.spec.whatwg.org/#node) `source`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-transformtodocument-source-source)); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) `setParameter`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-setparameter)(\[[LegacyNullToEmptyString](https://webidl.spec.whatwg.org/#LegacyNullToEmptyString)\] [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `namespaceURI`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-setparameter-namespaceuri-localname-value-namespaceuri), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-setparameter-namespaceuri-localname-value-localname), [any](https://webidl.spec.whatwg.org/#idl-any) `value`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-setparameter-namespaceuri-localname-value-value)); -[any](https://webidl.spec.whatwg.org/#idl-any) `getParameter`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-getparameter)(\[[LegacyNullToEmptyString](https://webidl.spec.whatwg.org/#LegacyNullToEmptyString)\] [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `namespaceURI`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-getparameter-namespaceuri-localname-namespaceuri), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-getparameter-namespaceuri-localname-localname)); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) `removeParameter`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-removeparameter)(\[[LegacyNullToEmptyString](https://webidl.spec.whatwg.org/#LegacyNullToEmptyString)\] [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `namespaceURI`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-removeparameter-namespaceuri-localname-namespaceuri), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-removeparameter-namespaceuri-localname-localname)); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) `clearParameters`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-clearparameters)(); -[undefined](https://webidl.spec.whatwg.org/#idl-undefined) `reset`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-reset)(); + `constructor`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-xsltprocessor)(); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) `importStylesheet`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-importstylesheet)([Node](https://dom.spec.whatwg.org/#node) `style`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-importstylesheet-style-style)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [DocumentFragment](https://dom.spec.whatwg.org/#documentfragment) `transformToFragment`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-transformtofragment)([Node](https://dom.spec.whatwg.org/#node) `source`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-transformtofragment-source-output-source), [Document](https://dom.spec.whatwg.org/#document) `output`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-transformtofragment-source-output-output)); + \[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)\] [Document](https://dom.spec.whatwg.org/#document) `transformToDocument`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-transformtodocument)([Node](https://dom.spec.whatwg.org/#node) `source`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-transformtodocument-source-source)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) `setParameter`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-setparameter)(\[[LegacyNullToEmptyString](https://webidl.spec.whatwg.org/#LegacyNullToEmptyString)\] [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `namespaceURI`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-setparameter-namespaceuri-localname-value-namespaceuri), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-setparameter-namespaceuri-localname-value-localname), [any](https://webidl.spec.whatwg.org/#idl-any) `value`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-setparameter-namespaceuri-localname-value-value)); + [any](https://webidl.spec.whatwg.org/#idl-any) `getParameter`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-getparameter)(\[[LegacyNullToEmptyString](https://webidl.spec.whatwg.org/#LegacyNullToEmptyString)\] [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `namespaceURI`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-getparameter-namespaceuri-localname-namespaceuri), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-getparameter-namespaceuri-localname-localname)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) `removeParameter`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-removeparameter)(\[[LegacyNullToEmptyString](https://webidl.spec.whatwg.org/#LegacyNullToEmptyString)\] [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `namespaceURI`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-removeparameter-namespaceuri-localname-namespaceuri), [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-removeparameter-namespaceuri-localname-localname)); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) `clearParameters`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-clearparameters)(); + [undefined](https://webidl.spec.whatwg.org/#idl-undefined) `reset`[](https://dom.spec.whatwg.org/#dom-xsltprocessor-reset)(); }; ## 10\. Historical[](https://dom.spec.whatwg.org/#historical) diff --git a/notes/BGOONZ_BLOG_2.0.wiki/Data-Structures.md.md b/notes/BGOONZ_BLOG_2.0.wiki/Data-Structures.md.md index d5e1d0cfe3..fb324a96c3 100644 --- a/notes/BGOONZ_BLOG_2.0.wiki/Data-Structures.md.md +++ b/notes/BGOONZ_BLOG_2.0.wiki/Data-Structures.md.md @@ -1,4 +1,5 @@ -## What are data structures +What are data structures +------------------------ Data structures, at a high level, are techniques for storing and organizing data that make it easier to modify, navigate, and access. Data structures determine how data is collected, the functions we can use to access it, and the relationships between data. @@ -20,7 +21,8 @@ JavaScript has primitive and non-primitive data structures. Primitive data stru Non-primitive data structures are not defined by the programming language but rather by the programmer. These include linear data structures, static data structures, and dynamic data structures, like queue and linked lists. -## 1\. Array +1\. Array +--------- The most basic of all data structures, an array stores data in memory for later use. Each array has a fixed number of cells decided on its creation, and each cell has a corresponding numeric index used to select its data. Whenever you'd like to use the array, all you need are the desired indices, and you can access any of the data within. @@ -42,7 +44,8 @@ Disadvantages - Basic spreadsheets - Within complex structures such as hash tables -## 2\. Queues +2\. Queues +---------- Queues are conceptually similar to stacks; both are sequential structures, but queues process elements in the order they were entered rather than the most recent element. @@ -68,7 +71,8 @@ Disadvantages - Convenient way to store order-sensitive data such as stored voicemails - Ensures the oldest data is processed first -## 3\. Linked List +3\. Linked List +--------------- Linked lists are a data structure which, unlike the previous three, does not use physical placement of data in memory. This means that, rather than indexes or positions, linked lists use a referencing system: elements are stored in nodes that contain a pointer to the next node, repeating until all nodes are linked. @@ -91,7 +95,8 @@ Disadvantages - Best used when data must be added and removed in quick succession from unknown locations -## 4\. Trees +4\. Trees +--------- Trees are another relation-based data structure, which specialize in representing hierarchical structures. Like a linked list, nodes contain both elements of data and pointers marking its relation to immediate nodes. @@ -130,9 +135,10 @@ Disadvantages - Storing hierarchical data such as a file location. - Binary search trees are excellent for tasks needing searching or ordering of data. -> _Enjoying the article? Scroll down to [sign up](https://www.educative.io/blog/blog-newsletter-annoucement) for our free, bi-monthly newsletter._ +> *Enjoying the article? Scroll down to [sign up](https://www.educative.io/blog/blog-newsletter-annoucement) for our free, bi-monthly newsletter.* -## 5\. Graphs +5\. Graphs +---------- Graphs are a relation-based data structure helpful for storing web-like relationships. Each node, or vertex, as they're called in graphs, has a title (A, B, C, etc.), a value contained within, and a list of links (called edges) it has with other vertices. @@ -140,9 +146,9 @@ Graphs are a relation-based data structure helpful for storing web-like relation In the above example, each circle is a vertex, and each line is an edge. If produced in writing, this structure would look like: -_V = {a, b, c, d}_ +*V = {a, b, c, d}* -_E = {ab, ac, bc, cd}_ +*E = {ab, ac, bc, cd}* While hard to visualize at first, this structure is invaluable in conveying relationship charts in textual form, anything from circuitry to train networks. @@ -161,7 +167,8 @@ Disadvantages - Network representations - Modeling social networks, such as Facebook. -## 6\. Hash Tables (Map) +6\. Hash Tables (Map) +--------------------- Hash tables are a complex data structure capable of storing large amounts of information and retrieving specific elements efficiently. This data structure relies on the concept of key/value pairs, where the "key" is a searched string and the "value" is the data paired with that key. @@ -186,7 +193,8 @@ Disadvantages Each hash table can be very different, from the types of the keys and values, to the way their hash functions work. Due to these differences and the multi-layered aspects of a hash table, it is nearly impossible to encapsulate so generally. -## Data structure interview questions +Data structure interview questions +---------------------------------- For many developers and programmers, data structures are most important for [cracking Javascript coding interviews](https://www.educative.io/blog/acing-the-javascript-interview-top-questions-explained). Questions and problems on data structures are fundamental to modern-day coding interviews. In fact, they have a lot to say over your hireability and entry-level rate as a candidate. @@ -232,17 +240,17 @@ There are two ways you could solve this coding problem in an interview. Let's di function removeEven(arr) { -var odds = [] +    var odds = [] -for (let number of arr) { +    for (let number of arr) { -if (number % 2 != 0) // Check if the item in the list is NOT even ('%' is the modulus symbol!) +        if (number % 2 != 0) // Check if the item in the list is NOT even ('%' is the modulus symbol!) -odds.push(number) //If it isn't even append it to the empty list +            odds.push(number) //If it isn't even append it to the empty list -} +    } -return odds // Return the new list +  return odds // Return the new list } @@ -250,12 +258,7 @@ console.log(removeEven([3, 2, 41, 3, 34])) Run -<<<<<<< HEAD This approach starts with the first element of the array. If that current element is not even, it pushes this element into a new array. If it is even, it will move to the next element, repeating until it reaches the end of the array. In regards to time complexity, since the entire array has to be iterated over, this solution is in *O(n)O(n).* -======= -This approach starts with the first element of the array. If that current element is not even, it pushes this element into a new array. If it is even, it will move to the next element, repeating until it reaches the end of the array. In regards to time complexity, since the entire array has to be iterated over, this solution is in _O(n)O(n)._ - -> > > > > > > af65185bd (-update) #### Solution #2: Using filter() and lambda function @@ -269,7 +272,7 @@ This approach starts with the first element of the array. If that current elemen function removeEven(arr) { -return arr.filter((v => (v % 2) != 0)) +    return arr.filter((v => (v % 2) != 0)) } @@ -367,53 +370,53 @@ Stack.js module.exports = class Stack { -constructor() { +    constructor() { -this.items = []; +        this.items = []; -this.top = null; +        this.top = null; -} +    } -getTop() { +    getTop() { -if (this.items.length == 0) +        if (this.items.length == 0) -return null; +            return null; -return this.top; +        return this.top; -} +    } -isEmpty() { +    isEmpty() { -return this.items.length == 0; +        return this.items.length == 0; -} +    } -size() { +    size() { -return this.items.length; +        return this.items.length; -} +    } -push(element) { +    push(element) { -this.items.push(element); +        this.items.push(element); -this.top = element; +        this.top = element; -} +    } -pop() { +    pop() { -if (this.items.length != 0) { +        if (this.items.length != 0) { -if (this.items.length == 1) { +            if (this.items.length == 1) { -this.top = null; +                this.top = null; -return this.items.pop(); +                return this.items.pop(); Run @@ -422,12 +425,7 @@ This process will iterate over the string one character at a time. We can determ 1. The stack is empty. 2. The top element in the stack is not the right type. -<<<<<<< HEAD If either of these conditions is true, we return `False`. If the parenthesis is an opening parenthesis, it is pushed into the stack. If by the end all are balanced, the stack will be empty. If it is not empty, we return `False`. Since we traverse the string exp only once, the time complexity is *O(n)*. -======= -If either of these conditions is true, we return `False`. If the parenthesis is an opening parenthesis, it is pushed into the stack. If by the end all are balanced, the stack will be empty. If it is not empty, we return `False`. Since we traverse the string exp only once, the time complexity is _O(n)_. - -> > > > > > > af65185bd (-update) ### Queue: Generate Binary Numbers from 1 to n @@ -517,45 +515,45 @@ Queue.js module.exports = class Queue { -constructor() { +    constructor() { -this.items = []; +        this.items = []; -this.front = null; +        this.front = null; -this.back = null; +        this.back = null; -} +    } -isEmpty() { +    isEmpty() { -return this.items.length == 0; +        return this.items.length == 0; -} +    } -getFront() { +    getFront() { -if (this.items.length != 0) { +        if (this.items.length != 0) { -return this.items[0]; +            return this.items[0]; -} else +        } else -return null; +            return null; -} +    } -size() { +    size() { -return this.items.length; +        return this.items.length; -} +    } -enqueue(element) { +    enqueue(element) { -this.items.push(element); +        this.items.push(element); -} +    } Run @@ -566,23 +564,13 @@ The key is to generate consecutive binary numbers by appending 0 and 1 to previo Once we generate a binary number, it is then enqueued to a queue so that new binary numbers can be generated if we append 0 and 1 when that number will be enqueued. -<<<<<<< HEAD Since a queue follows the *First-In First-Out* property, the enqueued binary numbers are dequeued so that the resulting array is mathematically correct. -======= -Since a queue follows the _First-In First-Out_ property, the enqueued binary numbers are dequeued so that the resulting array is mathematically correct. - -> > > > > > > af65185bd (-update) Look at the code above. On line 7, `1` is enqueued. To generate the sequence of binary numbers, a number is dequeued and stored in the array `result`. On lines 11-12, we append `0` and `1` to produce the next numbers. Those new numbers are also enqueued at lines 14-15. The queue will take integer values, so it converts the string to an integer as it is enqueued. -<<<<<<< HEAD The time complexity of this solution is in *O(n)O(n)* since constant-time operations are executed for n times. -======= -The time complexity of this solution is in _O(n)O(n)_ since constant-time operations are executed for n times. - -> > > > > > > af65185bd (-update) ### Linked List: Reverse a linked list @@ -676,53 +664,53 @@ const Node = require('./Node.js'); module.exports = class LinkedList { -constructor() { +  constructor() { -this.head = null; +    this.head = null; -} +  } -//Insertion At Head +  //Insertion At Head   -insertAtHead(newData) { +  insertAtHead(newData) { -let tempNode = new Node(newData); +    let tempNode = new Node(newData); -tempNode.nextElement = this.head; +    tempNode.nextElement = this.head; -this.head = tempNode; +    this.head = tempNode; -return this; //returning the updated list +    return this; //returning the updated list -} +  } -isEmpty() { +  isEmpty() { -return (this.head == null); +    return (this.head == null); -} +  } -//function to print the linked list +  //function to print the linked list -printList() { +  printList() { -if (this.isEmpty()) { +    if (this.isEmpty()) { -console.log("Empty List"); +      console.log("Empty List"); -return false; +      return false; -} else { +    } else { -let temp = this.head; +      let temp = this.head; -while (temp != null) { +      while (temp != null) { -process.stdout.write(String(temp.data)); +        process.stdout.write(String(temp.data)); -process.stdout.write(" -> "); +        process.stdout.write(" -> "); -temp = temp.nextElement; +        temp = temp.nextElement; Run @@ -734,12 +722,7 @@ We use a loop to iterate through the input list. For a `current` node, its lin - Line 25 - Use `next` to go to the next node - Line 29 - We reset the `head` pointer to point at the last node -<<<<<<< HEAD Since the list is traversed only once, the algorithm runs in *O(n)*. -======= -Since the list is traversed only once, the algorithm runs in _O(n)_. - -> > > > > > > af65185bd (-update) ### Tree: Find the Minimum Value in a Binary Search Tree @@ -837,53 +820,53 @@ const Node = require('./Node.js'); module.exports = class BinarySearchTree { -constructor(rootValue) { +    constructor(rootValue) { -this.root = new Node(rootValue); +        this.root = new Node(rootValue); -} +    } -insert(currentNode, newValue) { +    insert(currentNode, newValue) { -if (currentNode === null) { +        if (currentNode === null) { -currentNode = new Node(newValue); +            currentNode = new Node(newValue); -} else if (newValue < currentNode.val) { +        } else if (newValue < currentNode.val) { -currentNode.leftChild = this.insert(currentNode.leftChild, newValue); +            currentNode.leftChild = this.insert(currentNode.leftChild, newValue); -} else { +        } else { -currentNode.rightChild = this.insert(currentNode.rightChild, newValue); +            currentNode.rightChild = this.insert(currentNode.rightChild, newValue); -} +        } -return currentNode; +        return currentNode; -} +    } -insertBST(newValue) { +    insertBST(newValue) { -if(this.root==null){ +        if(this.root==null){ -this.root=new Node(newValue); +            this.root=new Node(newValue); -return; +            return; -} +        } -this.insert(this.root, newValue); +        this.insert(this.root, newValue); -} +    } -preOrderPrint(currentNode) { +    preOrderPrint(currentNode) { -if (currentNode !== null) { +        if (currentNode !== null) { -console.log(currentNode.val); +            console.log(currentNode.val); -this.preOrderPrint(currentNode.leftChild); +            this.preOrderPrint(currentNode.leftChild); Run @@ -991,43 +974,43 @@ const Node = require('./Node.js'); module.exports = class Graph { -constructor(vertices) { +  constructor(vertices) { -this.vertices = vertices; +    this.vertices = vertices; -this.list = []; +    this.list = []; -var it; +    var it; -for (it = 0; it < vertices; it++) { +    for (it = 0; it < vertices; it++) { -let temp = new LinkedList(); +      let temp = new LinkedList(); -this.list.push(temp); +      this.list.push(temp); -} +    } -} +  } -addEdge(source, destination) { +  addEdge(source, destination) { -if (source < this.vertices && destination < this.vertices) +    if (source < this.vertices && destination < this.vertices) -this.list[source].insertAtHead(destination); +    this.list[source].insertAtHead(destination); -return this; +    return this; -} +  } -printGraph() { +  printGraph() { -console.log(">>Adjacency List of Directed Graph<<"); +    console.log(">>Adjacency List of Directed Graph<<"); -var i; +    var i; -for (i = 0; i < this.list.length; i++) { +    for (i = 0; i < this.list.length; i++) { -process.stdout.write("|" + String(i) + "| => "); +      process.stdout.write("|" + String(i) + "| => "); Run @@ -1107,45 +1090,45 @@ To solve this problem, we must min heapify all parent nodes. Take a look. function minHeapify(heap, index) { -var left = index \* 2; +    var left = index * 2; -var right = (index \* 2) + 1; +    var right = (index * 2) + 1; -var smallest = index; +    var smallest = index; -if ((heap.length > left) && (heap[smallest] > heap[left])) { +    if ((heap.length > left) && (heap[smallest] > heap[left])) { -smallest = left +        smallest = left -} +    } -if ((heap.length > right) && (heap[smallest] > heap[right])) +    if ((heap.length > right) && (heap[smallest] > heap[right])) -smallest = right +        smallest = right -if (smallest != index) { +    if (smallest != index) { -var tmp = heap[smallest] +        var tmp = heap[smallest] -heap[smallest] = heap[index] +        heap[smallest] = heap[index] -heap[index] = tmp +        heap[index] = tmp -minHeapify(heap, smallest) +        minHeapify(heap, smallest) -} +    } -return heap; +    return heap; } function convertMax(maxHeap) { -for (var i = Math.floor((maxHeap.length) / 2); i > -1; i--) +    for (var i = Math.floor((maxHeap.length) / 2); i > -1; i--) -maxHeap = minHeapify(maxHeap, i) +        maxHeap = minHeapify(maxHeap, i) -return maxHeap +    return maxHeap } @@ -1155,9 +1138,4 @@ console.log(convertMax(maxHeap)) Run -<<<<<<< HEAD -We consider `maxHeap` to be a regular array and reorder it to accurately represent a min-heap. You can see this done in the code above. The `convertMax()` function then restores the heap property on all nodes from the lowest parent node by calling the `minHeapify()` function. In regards to time complexity, this solution takes *O(nlog(n))O(nlog(n))* time. -======= -We consider `maxHeap` to be a regular array and reorder it to accurately represent a min-heap. You can see this done in the code above. The `convertMax()` function then restores the heap property on all nodes from the lowest parent node by calling the `minHeapify()` function. In regards to time complexity, this solution takes _O(nlog(n))O(nlog(n))_ time. - -> > > > > > > af65185bd (-update) +We consider `maxHeap` to be a regular array and reorder it to accurately represent a min-heap. You can see this done in the code above. The `convertMax()` function then restores the heap property on all nodes from the lowest parent node by calling the `minHeapify()` function. In regards to time complexity, this solution takes *O(nlog(n))O(nlog(n))* time. \ No newline at end of file diff --git a/notes/BGOONZ_BLOG_2.0.wiki/Home.md b/notes/BGOONZ_BLOG_2.0.wiki/Home.md index bad063124d..f2a9fce832 100644 --- a/notes/BGOONZ_BLOG_2.0.wiki/Home.md +++ b/notes/BGOONZ_BLOG_2.0.wiki/Home.md @@ -1,17 +1,26 @@ # BRYAN GUNER BLOG & DOCUMENTATION SITE +### Web3 Storage API Token + +> eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6ZXRocjoweGM4MmYyNzQ3QTVGQWViNUM2ODlGOEM4MjM2OTgwNUMyMEEyMUFDQkIiLCJpc3MiOiJ3ZWIzLXN0b3JhZ2UiLCJpYXQiOjE2NDI0MjE0ODEwNTEsIm5hbWUiOiJibG9nLXN0b3JhZ2UifQ.c8LgkjRPYeAfs9plmncR0v6AlBdA-NoYbcuifcCEdiE + ---
-> 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 +>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 # Notion Page: [notion](https://www.notion.so/webdevhub42/Bgoonz-Blog-2-0-a82c419db97b4224bb1e4fdec981cbfb) + ##### [WEBSITE](https://bgoonz-blog.netlify.app/) ~~~ [Vercel Backup](https://bgoonz-blog-2-0-iuovoktmh-bgoonz.vercel.app/) ~~~ [Digital Ocean Backup](https://bgoonz-blog-2-0-gfvz5.ondigitalocean.app/) ~~~ [Gatsby Cloud Deploy](https://bgoonzblog20master.gatsbyjs.io/) + +
+ + - [Home](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki) - [add copy to code blocks.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/add-copy-to-code-blocks.md) @@ -122,12 +131,15 @@ - [wordpress vs headless cms.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/wordpress-vs-headless-cms.md) -[](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/_Sidebar/_edit 'Edit sidebar') +[](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/_Sidebar/_edit "Edit sidebar") -# Sitemap: +Sitemap: +======== ![blog](https://github.com/bgoonz/BGOONZ_BLOG_2.0/raw/master/static/images/blog-img.png) + + ## Docs Structure: ``` diff --git a/notes/BGOONZ_BLOG_2.0.wiki/Netlify-Injected-Content.md b/notes/BGOONZ_BLOG_2.0.wiki/Netlify-Injected-Content.md index d73f43e7c4..456dc9a8d1 100644 --- a/notes/BGOONZ_BLOG_2.0.wiki/Netlify-Injected-Content.md +++ b/notes/BGOONZ_BLOG_2.0.wiki/Netlify-Injected-Content.md @@ -1,7138 +1,7139 @@ ```html + + - - - - - - - - - - - - - - Web-Dev-Hub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + Web-Dev-Hub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ``` @@ -7141,6 +7142,4 @@ ="prefetch" href="/page-data/lorem-ipsum/page-data.json" crossorigin="anonymous" as="fetch"> -``` - -``` +``` \ No newline at end of file diff --git a/notes/BGOONZ_BLOG_2.0.wiki/SEO.md.md b/notes/BGOONZ_BLOG_2.0.wiki/SEO.md.md index ba5ab4e9b5..c96368db92 100644 --- a/notes/BGOONZ_BLOG_2.0.wiki/SEO.md.md +++ b/notes/BGOONZ_BLOG_2.0.wiki/SEO.md.md @@ -1,7 +1,7 @@ # SEO Report for [https://bgoonz-blog.netlify.app/](https://bgoonz-blog.netlify.app/) -### But first: +### But first: ##### Seo Resources: [![](https://www.google.com/s2/favicons?domain=https://search.google.com/test/mobile-friendly)](https://search.google.com/test/mobile-friendly?referer=seo-extension.com&url=https%3A%2F%2Fbgoonz-blog.netlify.app%2F)[Is your page is **Mobile Friendly ?**](https://search.google.com/test/mobile-friendly?referer=seo-extension.com&url=https%3A%2F%2Fbgoonz-blog.netlify.app%2F) @@ -20,7 +20,7 @@ [![](https://www.google.com/s2/favicons?domain=https://www.google.be/)](https://search.google.com/test/rich-results?url=https%3A%2F%2Fbgoonz-blog.netlify.app%2F&user_agent=1)[Check **Microdata, Microformats** and **RDFa**](https://search.google.com/test/rich-results?url=https%3A%2F%2Fbgoonz-blog.netlify.app%2F&user_agent=1) ---- +* * * * * SEO @@ -50,7 +50,7 @@ Security/Malware [![](https://www.google.com/s2/favicons?domain=http://www.google.com/)](http://www.google.com/safebrowsing/diagnostic?site=bgoonz-blog.netlify.app)[Safe Browsing (Google)](http://www.google.com/safebrowsing/diagnostic?site=bgoonz-blog.netlify.app) ---- +* * * * * Other (whois,...) @@ -73,13 +73,16 @@ Other (whois,...) [![](https://www.google.com/s2/favicons?domain=https://www.quantcast.com)](https://www.quantcast.com/bgoonz-blog.netlify.app)[quantcast.com](https://www.quantcast.com/bgoonz-blog.netlify.app) --- - --- - --- - --- + + + + + + Title ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png)\ 11 characters @@ -119,20 +122,20 @@ Lang ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.pn Lang attribut of HTML element is missing. -| H1 | H2 | H3 | H4 | H5 | H6 ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png) | Images ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png) | Links ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png) | -| --- | --- | --- | --- | --- | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| 3 | 10 | 29 | 1 | 0 | 1 | 26 | 137 | +| H1 | H2 | H3 | H4 | H5 | H6 ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png) | Images ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png) | Links ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png) | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 3 | 10 | 29 | 1 | 0 | 1 | 26 | 137 | ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/ga-icon-na.png) ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png) [Robots.txt](https://bgoonz-blog.netlify.app/robots.txt) ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png) | [Sitemap.xml](https://bgoonz-blog.netlify.app/sitemap.xml) ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png) ---- +* * * * * ALL LINKS\ -APPLE-TOUCH-ICON : [logo-circle.png](https://bgoonz-blog.netlify.app/logo-circle.png 'apple-touch-icon')\ -APPLE-TOUCH-ICON : [logo-canvas.png](https://instructure-uploads-pdx.s3.us-west-2.amazonaws.com/account_168550000000000001/attachments/537/logo-canvas.png 'apple-touch-icon')\ -ICON : [webdevhublogo2.PNG](https://bgoonz-blog.netlify.app/images/webdevhublogo2.PNG 'icon')\ +APPLE-TOUCH-ICON : [logo-circle.png](https://bgoonz-blog.netlify.app/logo-circle.png "apple-touch-icon")\ +APPLE-TOUCH-ICON : [logo-canvas.png](https://instructure-uploads-pdx.s3.us-west-2.amazonaws.com/account_168550000000000001/attachments/537/logo-canvas.png "apple-touch-icon")\ +ICON : [webdevhublogo2.PNG](https://bgoonz-blog.netlify.app/images/webdevhublogo2.PNG "icon")\ PRECONNECT : https://fonts.gstatic.com\ PREFETCH : component---src-templates-advanced-js-c66268766ef5c957450f.js\ PREFETCH : component---src-templates-blog-js-36eb4fae1add87ca6010.js\ @@ -164,14 +167,14 @@ PRELOAD : integrator.js\ PRELOAD : page-data.json\ PRELOAD : styles-7d4153d260c0197f0043.js\ PRELOAD : webpack-runtime-7059fe0afa2407e27b1a.js\ -SHORTCUT ICON : [favicon.ico](https://bgoonz-blog.netlify.app/favicon.ico 'shortcut icon')\ +SHORTCUT ICON : [favicon.ico](https://bgoonz-blog.netlify.app/favicon.ico "shortcut icon")\ STYLESHEET : [default.min.css](https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.2.0/build/styles/default.min.css)\ STYLESHEET : [algoliasearchNetlify.css](https://cdn.jsdelivr.net/npm/@algolia/algoliasearch-netlify-frontend@1/dist/algoliasearchNetlify.css)\ STYLESHEET : [bootstrap.min.css](https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css)\ STYLESHEET : \ STYLESHEET : [css](https://fonts.googleapis.com/css?family=Raleway:200,100,400) ---- +* * * * * ALL METAS\ AUTHOR : Bryan Guner\ @@ -202,9 +205,9 @@ HTTP-EQUIV (ORIGIN-TRIAL) : Azuce85ORtSnWe1MZDTv68qpaW3iHyfL9YbLRy0cwcCZwVnePnO HTTP-EQUIV (ORIGIN-TRIAL) : Azuce85ORtSnWe1MZDTv68qpaW3iHyfL9YbLRy0cwcCZwVnePnOmkUJlG8HGikmOwhZU22dElCcfrfX2HhrBPAkAAAB7eyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9\ OG:DESCRIPTION : my resource sharing and blog site ... centered mostly on web development and just a bit of audio production / generally nerdy things I find interesting.\ OG:DESCRIPTION : my resource sharing and blog site ... centered mostly on web development and just a bit of audio production / generally nerdy things I find interesting.\ -OG:IMAGE : [code.png](https://bgoonz-blog.netlify.app/images/code.png 'code.png')\ -OG:IMAGE : [code.png](https://bgoonz-blog.netlify.app/images/code.png 'code.png')\ -OG:IMAGE : [DROicc16](https://mugshotbot.com/m/DROicc16 'DROicc16')\ +OG:IMAGE : [code.png](https://bgoonz-blog.netlify.app/images/code.png "code.png")\ +OG:IMAGE : [code.png](https://bgoonz-blog.netlify.app/images/code.png "code.png")\ +OG:IMAGE : [DROicc16](https://mugshotbot.com/m/DROicc16 "DROicc16")\ OG:TITLE : Web-Dev-Hub\ OG:TITLE : Web-Dev-Hub\ OG:TYPE : website\ @@ -219,9 +222,9 @@ TWITTER:DESCRIPTION : The new home of my blog resource sharing website.\ TWITTER:DESCRIPTION : Web-Dev-Hub\ TWITTER:DESCRIPTION : my resource sharing and blog site ... centered mostly on web development and just a bit of audio production / generally nerdy things I find interesting.\ TWITTER:DOMAIN : bgoonz-blog.netlify.app\ -TWITTER:IMAGE : [4.jpg](https://bgoonz-blog.netlify.app/images/4.jpg '4.jpg')\ -TWITTER:IMAGE : [code.png](https://bgoonz-blog.netlify.app/images/code.png 'code.png')\ -TWITTER:IMAGE:SRC : [logo-circle.png](https://bgoonz-blog.netlify.app/logo-circle.png 'logo-circle.png')\ +TWITTER:IMAGE : [4.jpg](https://bgoonz-blog.netlify.app/images/4.jpg "4.jpg")\ +TWITTER:IMAGE : [code.png](https://bgoonz-blog.netlify.app/images/code.png "code.png")\ +TWITTER:IMAGE:SRC : [logo-circle.png](https://bgoonz-blog.netlify.app/logo-circle.png "logo-circle.png")\ TWITTER:SITE : @bgoonz\ TWITTER:TITLE : Web Development Resource Hub Bryan Guner\ TWITTER:TITLE : Web-Dev-Hub\ @@ -232,7 +235,7 @@ VIEWPORT : width=device-width, initial-scale=1.0\ VIEWPORT : width=device-width, initial-scale=1\ VIEWPORT : width=device-width, initialScale=1.0 ---- +* * * * * ALL SCRIPTS\ SCRIPT : [![](https://www.google.com/s2/favicons?domain=https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js) jquery.min.js](https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js)\ @@ -260,9 +263,8 @@ TEXT/JAVASCRIPT : [![](https://www.google.com/s2/favicons?domain=https://www.go TEXT/JAVASCRIPT : [![](https://www.google.com/s2/favicons?domain=https://www.googletagmanager.com/gtag/js?id=G-F56YP2Y17L&l=dataLayer&cx=c) js](https://www.googletagmanager.com/gtag/js?id=G-F56YP2Y17L&l=dataLayer&cx=c)\ TEXT/JAVASCRIPT : [![](https://www.google.com/s2/favicons?domain=https://www.smartsuppchat.com/loader.js?) loader.js](https://www.smartsuppchat.com/loader.js?) ---- +* * * * * -<<<<<<< HEAD XFN / Rel attr. (Xhtml Friends Network)  ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png)\ NOFOLLOW: [byfreefind](https://www.freefind.com/)\ NOFOLLOW: [search engine](https://www.freefind.com/)\ @@ -300,50 +302,12 @@ NOOPENER : [ds-algo](https://bgoonz-blog.netlify.app/docs/articles/ds-algo-over NOOPENER : [Blog-Post-Archive](https://bgoonz.blogspot.com/)\ NOOPENER : [Blog](https://bgoonz-blog.netlify.app/blog/)\ NOOPENER : [Python](https://bgoonz-blog.netlify.app/docs/python/python-ds) -======= -XFN / Rel attr. (Xhtml Friends Network) ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png)\ -NOFOLLOW: [byfreefind](https://www.freefind.com/)\ -NOFOLLOW: [search engine](https://www.freefind.com/)\ -NOOPENER : [dev.to](https://dev.to/bgoonz)\ -NOOPENER : [Instagram](https://www.instagram.com/bgoonz/?hl=en)\ -NOOPENER : [Youtube](https://www.youtube.com/channel/UC9-rYyUMsnEBK8G8fCyrXXA)\ -NOOPENER : [GitHub](https://github.com/bgoonz)\ -NOOPENER : [LinkedIn](https://www.linkedin.com/in/bryan-guner-046199128/)\ -NOOPENER : [Twitter](https://twitter.com/bgooonz)\ -NOOPENER : [BLM](https://optimistic-lewin-8586ae.netlify.app/blm.zip)\ -NOOPENER : [Medium](https://bryanguner.medium.com/)\ -NOOPENER : [Go To Web Audio Daw](https://mihirbegmusiclab.netlify.app/)\ -NOOPENER : [Contact](https://sidebar-blog.netlify.app/contact/)\ -NOOPENER : [Github-Advanced-Search](https://github.com/search/advanced)\ -NOOPENER : [PotluckPlanner](https://potluck-landing.netlify.app/)\ -NOOPENER : [Setup Checker](https://github.com/bgoonz/web-dev-setup-checker)\ -NOOPENER : [Job Search Resources](https://determined-dijkstra-ee7390.netlify.app/)\ -NOOPENER : [Ternary 2 If Else](https://ternary42.netlify.app/)\ -NOOPENER : [Text Tools](https://devtools42.netlify.app/)\ -NOOPENER : [Github HTML Previewer](https://githtmlpreview.netlify.app/)\ -NOOPENER : [Wordpress Blog](https://web-dev-hub.com/)\ -NOOPENER : [Blog Backup](https://bgoonz-blog-v3-0.netlify.app/)\ -NOOPENER : [Condensed -Portfolio](https://bg-portfolio.netlify.app/)\ -NOOPENER : [SearchAwesome](https://bgoonz.github.io/searchAwesome/)\ -NOOPENER : [WebAudioLab](https://panoramic-eggplant-452e4.netlify.app/)\ -NOOPENER : [Meditation App](https://meditate42app.netlify.app/)\ -NOOPENER : [Potluck Planner](https://potluck-landing.netlify.app/)\ -NOOPENER : [Projects](https://project-portfolio42.netlify.app/)\ -NOOPENER : [OG-Blog](https://web-dev-resource-hub.netlify.app/)\ -NOOPENER : [Resource-Archive-Server](https://github.com/bgoonz/Learning-Assets)\ -NOOPENER : [Archive](https://github.com/bgoonz/UsefulResourceRepo2.0)\ -NOOPENER : [nodejs](https://bgoonz-blog.netlify.app/docs/articles/nodejs/)\ -NOOPENER : [platform docs](https://bgoonz-blog.netlify.app/blog/platform-docs/)\ -NOOPENER : [ds-algo](https://bgoonz-blog.netlify.app/docs/articles/ds-algo-overview/)\ -NOOPENER : [Blog-Post-Archive](https://bgoonz.blogspot.com/)\ -NOOPENER : [Blog](https://bgoonz-blog.netlify.app/blog/)\ -NOOPENER : [Python](https://bgoonz-blog.netlify.app/docs/python/python-ds) - -> > > > > > > af65185bd (-update) + + HTML. ---- +* * * * * **

** I am a musician, electrical engineer & web developer @@ -433,11 +397,18 @@ HTML. **

** Current local time inNew York City, United States ---- +* * * * * + +| H1 | H2 | H3 | H4 | H5 | H6 ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png) | +| --- | --- | --- | --- | --- | --- | +| 3 | 10 | 29 | 1 | 0 | 1 | + + + + + + -| H1 | H2 | H3 | H4 | H5 | H6 ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png) | -| --- | --- | --- | --- | --- | ------------------------------------------------------------------------------- | -| 3 | 10 | 29 | 1 | 0 | 1 | IMAGES ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png)\ 26 @@ -448,7 +419,7 @@ without ALT\ without TITLE\ 26 ---- +* * * * * Analyze and optimize your images with @@ -560,6 +531,10 @@ Title: /\ ALT: Black Lives Matter Badge\ Title: / | + + + + LINKS ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png)\ 137 @@ -572,7 +547,7 @@ internal unique\ without TITLE\ 103 ---- +* * * * * LINKS @@ -916,6 +891,19 @@ Title: /\ | mailto:bryan.guner@gmail.com (email)\ Title: / | + + + + + + + + + + + + + OPEN GRAPH (Facebook) ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/help-icon-i.png) | og:type\ @@ -997,3 +985,22 @@ Schema.org (itemtype only) ![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpn | No DATA has been found for Schema.org (itemtype only) | [![](chrome-extension://bjogjfinolnhfhkbipphpdlldadpnmhc/img/tools/no-logo.png)](https://search.google.com/test/rich-results?url=https%3A%2F%2Fbgoonz-blog.netlify.app%2F&user_agent=1)[Click here to check **Schema.org structure** of this page (Google validator)](https://search.google.com/test/rich-results?url=https%3A%2F%2Fbgoonz-blog.netlify.app%2F&user_agent=1) + + + + + + + + + + + + + + + + + + + diff --git a/notes/BGOONZ_BLOG_2.0.wiki/STABLE_POINTS.md.md b/notes/BGOONZ_BLOG_2.0.wiki/STABLE_POINTS.md.md index 3b82c2f426..91d55b1982 100644 --- a/notes/BGOONZ_BLOG_2.0.wiki/STABLE_POINTS.md.md +++ b/notes/BGOONZ_BLOG_2.0.wiki/STABLE_POINTS.md.md @@ -1,13 +1,21 @@ -- [stable 8-13-2021](https://github.com/bgoonz/BGOONZ_BLOG_2.0/commit/0c09a707f4bfddd974a31d97a4f8d716f1858ef8) or [or maybe](https://github.com/bgoonz/BGOONZ_BLOG_2.0/commit/68fba78e36fffcf21288ea0e90e1075bf31b2a82) +- [stable 8-13-2021](https://github.com/bgoonz/BGOONZ_BLOG_2.0/commit/0c09a707f4bfddd974a31d97a4f8d716f1858ef8) or [or maybe](https://github.com/bgoonz/BGOONZ_BLOG_2.0/commit/68fba78e36fffcf21288ea0e90e1075bf31b2a82) -- [Stable September 11](https://github.com/side-projects-42/BGOONZ_BLOG_2.0) -- [October Stable](https://github.com/Web-Dev-Collaborative/october-stable) +- [Stable September 11](https://github.com/side-projects-42/BGOONZ_BLOG_2.0) -- [November 2021 stable](https://github.com/bgoonz/BGOONZ_BLOG_2.0/commit/9ae5da5813cc9b48d2a57c84cd32cf4309078524) -- [Late November Stable](https://github.com/bgoonz/BGOONZ_BLOG_2.0/commit/40ecc95f000a848710c39e166961b8da7fca306b) +- [October Stable](https://github.com/Web-Dev-Collaborative/october-stable) -- [December](https://github.com/bgoonz/BGOONZ_BLOG_2.0/tree/fc4a6ba1d61a3ef0b893cc5a44e41672547a3cc6) -- [Late December](https://github.com/bgoonz/BGOONZ_BLOG_2.0/commit/848a8505eece492bfd9856eb63bd4acbee8bced6) +- [November 2021 stable](https://github.com/bgoonz/BGOONZ_BLOG_2.0/commit/9ae5da5813cc9b48d2a57c84cd32cf4309078524) + +- [Late November Stable](https://github.com/bgoonz/BGOONZ_BLOG_2.0/commit/40ecc95f000a848710c39e166961b8da7fca306b) + +- [December](https://github.com/bgoonz/BGOONZ_BLOG_2.0/tree/fc4a6ba1d61a3ef0b893cc5a44e41672547a3cc6) + +- [Late December](https://github.com/bgoonz/BGOONZ_BLOG_2.0/commit/848a8505eece492bfd9856eb63bd4acbee8bced6) + +- [Late January](https://github.com/bgoonz/BGOONZ_BLOG_2.0/pull/1447) + + +- [Good stable point](https://github.com/bgoonz/BGOONZ_BLOG_2.0/commit/90f70928a145c8a784899baf62efc2a0d5697bf4) \ No newline at end of file diff --git a/notes/BGOONZ_BLOG_2.0.wiki/THINGS-TO-EMBED.md.md b/notes/BGOONZ_BLOG_2.0.wiki/THINGS-TO-EMBED.md.md index 7743304187..96c5b34c37 100644 --- a/notes/BGOONZ_BLOG_2.0.wiki/THINGS-TO-EMBED.md.md +++ b/notes/BGOONZ_BLOG_2.0.wiki/THINGS-TO-EMBED.md.md @@ -1,28 +1,28 @@ -- [Dev Journal](https://dev-journal42.netlify.app/) +- [Dev Journal](https://dev-journal42.netlify.app/) -- [**Graduation Certificate**](https://www.credly.com/badges/bd145ba3-0f09-42fc-8d1f-a3bc4e0a46b4/public_url) +- [**Graduation Certificate**](https://www.credly.com/badges/bd145ba3-0f09-42fc-8d1f-a3bc4e0a46b4/public_url) -https://determined-dijkstra-ee7390.netlify.app/ -https://links4242.netlify.app/ -https://markdown-templates-42.netlify.app/ -https://sidebar-blog.netlify.app/ + https://determined-dijkstra-ee7390.netlify.app/ +https://links4242.netlify.app/ +https://markdown-templates-42.netlify.app/ +https://sidebar-blog.netlify.app/ https://friendly-amaranth-51833.netlify.app/ -https://bgoonzbookmarks.netlify.app/ -https://sanity-gatsby-hey-sugar-5.netlify.app/ -https://sanity-gatsby-hey-sugar-5.netlify.app/ -https://dev-journal42.netlify.app/ -https://kguner-fractions-website.netlify.app/ -https://sanity-gatsby-blog-web-skwx3b17.netlify.app/ -https://ds-algo-official.netlify.app/ -https://random-list-of-embedable-content.vercel.app/ -https://mihirbegmusiclab.netlify.app/ -https://lambda-resources.netlify.app/ -https://ds-unit-5-lambda.netlify.app/ -https://www.youtube.com/embed/xGZSWvFess8 +https://bgoonzbookmarks.netlify.app/ +https://sanity-gatsby-hey-sugar-5.netlify.app/ +https://sanity-gatsby-hey-sugar-5.netlify.app/ +https://dev-journal42.netlify.app/ +https://kguner-fractions-website.netlify.app/ +https://sanity-gatsby-blog-web-skwx3b17.netlify.app/ +https://ds-algo-official.netlify.app/ +https://random-list-of-embedable-content.vercel.app/ +https://mihirbegmusiclab.netlify.app/ +https://lambda-resources.netlify.app/ +https://ds-unit-5-lambda.netlify.app/ +https://www.youtube.com/embed/xGZSWvFess8 https://bgoonz.blogspot.com/ [BobbyG](https://futuristic-rosemary-d4acc.netlify.app/) https://iframeshowcase.netlify.app/ https://react-calculator2.vercel.app/ -https://replit.com/@bgoonz/bgoonzblog-things-2-remember#index.html +https://replit.com/@bgoonz/bgoonzblog-things-2-remember#index.html \ No newline at end of file diff --git a/notes/BGOONZ_BLOG_2.0.wiki/Technologies-Used.md.md b/notes/BGOONZ_BLOG_2.0.wiki/Technologies-Used.md.md index 5c21390e80..acab532b85 100644 --- a/notes/BGOONZ_BLOG_2.0.wiki/Technologies-Used.md.md +++ b/notes/BGOONZ_BLOG_2.0.wiki/Technologies-Used.md.md @@ -1 +1 @@ -![techused](https://i.imgur.com/XVNWUvU.png) +![techused](https://i.imgur.com/XVNWUvU.png) \ No newline at end of file diff --git a/notes/BGOONZ_BLOG_2.0.wiki/Todo.md.md b/notes/BGOONZ_BLOG_2.0.wiki/Todo.md.md new file mode 100644 index 0000000000..d1c68b5740 --- /dev/null +++ b/notes/BGOONZ_BLOG_2.0.wiki/Todo.md.md @@ -0,0 +1 @@ +# Todo \ No newline at end of file diff --git a/notes/BGOONZ_BLOG_2.0.wiki/_Footer.md b/notes/BGOONZ_BLOG_2.0.wiki/_Footer.md index 4b1bdc575b..682f9112bb 100644 --- a/notes/BGOONZ_BLOG_2.0.wiki/_Footer.md +++ b/notes/BGOONZ_BLOG_2.0.wiki/_Footer.md @@ -1,14 +1,14 @@ -- [sitemap](https://www.xml-sitemaps.com/download/bgoonz-blog.netlify.app-ee43723d7/sitemap.xml?view=1) -- [initial commit](https://github.com/bgoonz/BGOONZ_BLOG_2.0/commit/e8f12effd461b560b366ee0bde5231f2c1ce0a4c) -- [commit pages](https://github.com/bgoonz/BGOONZ_BLOG_2.0/commits/master?after=496dfce7e627bc81c80f7c0b5c41ecf420500b4a+34&branch=master) -- [alt blog contact page](https://bgoonz-blog-v3-0.netlify.app/contact/) -- [Resource Archive](https://resourcerepo2.netlify.app/) -- [starter](https://codesandbox.io/s/ecstatic-wozniak-gj31v?autoresize=1&expanddevtools=1&fontsize=12&hidenavigation=1&theme=dark) -- [Instant Search Demo](https://codesandbox.io/s/magical-davinci-l4hq6) -- [midway-commit](https://github.com/bgoonz/BGOONZ_BLOG_2.0/tree/92d88002bebcde66b47d8109222ac62c64fa9909) -- [blog2.0 backups](https://gist.github.com/bgoonz/68203bca236305d93d75e87533c7e8b8) -- [backup repo](https://github.com/bgoonz/blog-2.o-versions) -- [autogen sitemap](https://bgoonz-blog.netlify.app/sitemap.xml) +- [sitemap](https://www.xml-sitemaps.com/download/bgoonz-blog.netlify.app-ee43723d7/sitemap.xml?view=1) +- [initial commit](https://github.com/bgoonz/BGOONZ_BLOG_2.0/commit/e8f12effd461b560b366ee0bde5231f2c1ce0a4c) +- [commit pages](https://github.com/bgoonz/BGOONZ_BLOG_2.0/commits/master?after=496dfce7e627bc81c80f7c0b5c41ecf420500b4a+34&branch=master) +- [alt blog contact page](https://bgoonz-blog-v3-0.netlify.app/contact/) +- [Resource Archive](https://resourcerepo2.netlify.app/) +- [starter](https://codesandbox.io/s/ecstatic-wozniak-gj31v?autoresize=1&expanddevtools=1&fontsize=12&hidenavigation=1&theme=dark) +- [Instant Search Demo](https://codesandbox.io/s/magical-davinci-l4hq6) +- [midway-commit](https://github.com/bgoonz/BGOONZ_BLOG_2.0/tree/92d88002bebcde66b47d8109222ac62c64fa9909) +- [blog2.0 backups](https://gist.github.com/bgoonz/68203bca236305d93d75e87533c7e8b8) +- [backup repo](https://github.com/bgoonz/blog-2.o-versions) +- [autogen sitemap](https://bgoonz-blog.netlify.app/sitemap.xml) - [Home](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki) - [contentauthoring.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/contentauthoring.md) - [inject3.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/inject3.md) @@ -20,10 +20,14 @@ - [stable points.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/stable-points.md) - [validation report.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/validation-report.md) -- [Google Analytics Report](https://datastudio.google.com/reporting/d0496ad8-b6be-469d-9708-3ec88b05e2b4) +- [Google Analytics Report](https://datastudio.google.com/reporting/d0496ad8-b6be-469d-9708-3ec88b05e2b4) + + ## Wiki Nav: + + - [Home](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki) - [add copy to code blocks.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/add-copy-to-code-blocks.md) @@ -132,4 +136,4 @@ - [webhooks.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/webhooks.md) -- [wordpress vs headless cms.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/wordpress-vs-headless-cms.md) +- [wordpress vs headless cms.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/wordpress-vs-headless-cms.md) \ No newline at end of file diff --git a/notes/BGOONZ_BLOG_2.0.wiki/_Sidebar.md b/notes/BGOONZ_BLOG_2.0.wiki/_Sidebar.md index 475c698310..cc67267d3b 100644 --- a/notes/BGOONZ_BLOG_2.0.wiki/_Sidebar.md +++ b/notes/BGOONZ_BLOG_2.0.wiki/_Sidebar.md @@ -1,43 +1,41 @@ # Sitemap: --- - # Wiki Navigation - -- [Home](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki) -- [add copy to code blocks.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/add-copy-to-code-blocks.md) -- [Add site search w algolia.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/Add-site-search-w-algolia.md) -- [adding mailing list.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/adding-mailing-list.md) -- [Adding search 2 gatsby site.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/Adding-search-2-gatsby-site.md) -- [awesome.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/awesome.md) -- [broken links.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/broken-links.md) -- [configure custom domain.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/configure-custom-domain.md) -- [contentauthoring.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/contentauthoring.md) -- [full text search w lunar.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/full-text-search-w-lunar.md) -- [inject 4.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/inject-4.md) -- [inject3.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/inject3.md) -- [inject4.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/inject4.md) -- [injected content part2.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/injected-content-part2.md) -- [injected js part4.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/injected-js-part4.md) -- [injected part3.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/injected-part3.md) -- [links 2 embed.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/links-2-embed.md) -- [links to remember](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/links-to-remember) -- [Netlify Injected Content](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/Netlify-Injected-Content) -- [old version of index.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/old-version-of-index.md) -- [optimize vscode.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/optimize-vscode.md) -- [possibly useful snippets.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/possibly-useful-snippets.md) -- [privacy policy.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/privacy-policy.md) -- [random stuff.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/random-stuff.md) -- [random.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/random.md) -- [ref type](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/ref-type) -- [SEO.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/SEO.md) -- [stable points.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/stable-points.md) -- [tech used.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/tech-used.md) -- [Technologies Used.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/Technologies-Used.md) -- [THINGS TO EMBED.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/THINGS-TO-EMBED.md) -- [validation report.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/validation-report.md) -- [web archive.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/web-archive.md) -- [wordpress vs headless cms.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/wordpress-vs-headless-cms.md) +- [Home](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki) +- [add copy to code blocks.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/add-copy-to-code-blocks.md) +- [Add site search w algolia.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/Add-site-search-w-algolia.md) +- [adding mailing list.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/adding-mailing-list.md) +- [Adding search 2 gatsby site.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/Adding-search-2-gatsby-site.md) +- [awesome.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/awesome.md) +- [broken links.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/broken-links.md) +- [configure custom domain.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/configure-custom-domain.md) +- [contentauthoring.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/contentauthoring.md) +- [full text search w lunar.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/full-text-search-w-lunar.md) +- [inject 4.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/inject-4.md) +- [inject3.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/inject3.md) +- [inject4.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/inject4.md) +- [injected content part2.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/injected-content-part2.md) +- [injected js part4.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/injected-js-part4.md) +- [injected part3.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/injected-part3.md) +- [links 2 embed.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/links-2-embed.md) +- [links to remember](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/links-to-remember) +- [Netlify Injected Content](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/Netlify-Injected-Content) +- [old version of index.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/old-version-of-index.md) +- [optimize vscode.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/optimize-vscode.md) +- [possibly useful snippets.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/possibly-useful-snippets.md) +- [privacy policy.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/privacy-policy.md) +- [random stuff.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/random-stuff.md) +- [random.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/random.md) +- [ref type](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/ref-type) +- [SEO.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/SEO.md) +- [stable points.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/stable-points.md) +- [tech used.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/tech-used.md) +- [Technologies Used.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/Technologies-Used.md) +- [THINGS TO EMBED.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/THINGS-TO-EMBED.md) +- [validation report.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/validation-report.md) +- [web archive.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/web-archive.md) +- [wordpress vs headless cms.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/wordpress-vs-headless-cms.md) - [Home](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki) - [add copy to code blocks.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/add-copy-to-code-blocks.md) @@ -95,7 +93,12 @@ - [webhooks.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/webhooks.md) - [wordpress vs headless cms.md](https://github.com/bgoonz/BGOONZ_BLOG_2.0/wiki/wordpress-vs-headless-cms.md) -# Sitemap: + + +Sitemap: +======== + + --- @@ -229,4 +232,4 @@ --- -### - [✅] [notes-template](https://bgoonz-blog.netlify.app/notes-template/) +### - [✅] [notes-template](https://bgoonz-blog.netlify.app/notes-template/) \ No newline at end of file diff --git a/notes/BGOONZ_BLOG_2.0.wiki/add-copy-to-code-blocks.md.md b/notes/BGOONZ_BLOG_2.0.wiki/add-copy-to-code-blocks.md.md index 56a92a4369..2ac3de2562 100644 --- a/notes/BGOONZ_BLOG_2.0.wiki/add-copy-to-code-blocks.md.md +++ b/notes/BGOONZ_BLOG_2.0.wiki/add-copy-to-code-blocks.md.md @@ -1,10 +1,12 @@ -# gatsby-remark-code-buttons +gatsby-remark-code-buttons +========================== Add buttons to **markdown** code snippets. > This plugin doesn't support MDX. Example of [MDX copy button](https://github.com/gatsbyjs/gatsby/pull/15834). -## [](https://www.gatsbyjs.com/plugins/gatsby-remark-code-buttons/#install)Install +[](https://www.gatsbyjs.com/plugins/gatsby-remark-code-buttons/#install)Install +------------------------------------------------------------------------------- ``` npm install gatsby-remark-code-buttons --save-dev @@ -12,7 +14,8 @@ npm install gatsby-remark-code-buttons --save-dev ![](https://media.giphy.com/media/hoHRea4IdkDBrsE4Bu/source.gif) -## [](https://www.gatsbyjs.com/plugins/gatsby-remark-code-buttons/#how-to-use)How to use +[](https://www.gatsbyjs.com/plugins/gatsby-remark-code-buttons/#how-to-use)How to use +------------------------------------------------------------------------------------- in your `gatsby-config.js` @@ -27,7 +30,8 @@ plugins: [ ] ``` -## [](https://www.gatsbyjs.com/plugins/gatsby-remark-code-buttons/#options)Options +[](https://www.gatsbyjs.com/plugins/gatsby-remark-code-buttons/#options)Options +------------------------------------------------------------------------------- ``` plugins: [ @@ -92,17 +96,15 @@ import './src/styles/custom-code-buttons.scss'; In your Markdown content -```` +``` ```js alert('click to copy 💾'); -```` - +``` ``` This plugin will parse the Markdown AST, pluck the button, and then "clean" the code snippet language for further processing. With the default config options this plugin will create the following structure, injecting a custom `div`: ``` -
copy text from #mysection @@ -260,7 +257,6 @@ The button is only shown when `navigator.clipboard.writeText()` is supported. The text paste button is very similar except it defines a `data-paste` attribute which must point to a DOM node: ``` - @@ -274,13 +270,12 @@ The Clipboard API's [`readText()`](https://developer.mozilla.org/Web/API/Clipbo Copying requires blob data typically returned by a [`fetch()`](https://developer.mozilla.org/Web/API/Fetch_API) or [`canvas.toBlob()`](https://developer.mozilla.org/Web/API/HTMLCanvasElement/toBlob) method. This is passed to a [`ClipboardItem`](https://developer.mozilla.org/Web/API/ClipboardItem) constructor so it can be written to the clipboard: ``` - const -image = await fetch('myimage.png'), -blob = await image.blob(); + image = await fetch('myimage.png'), + blob = await image.blob(); await navigator.clipboard.write([ -new ClipboardItem({ [blob.type]: blob }) + new ClipboardItem({ [blob.type]: blob }) ]); ``` @@ -288,12 +283,11 @@ new ClipboardItem({ [blob.type]: blob }) Pasting is more complex because multiple `ClipboardItem` objects can be returned with differing content types. It's therefore necessary to iterate through each type until a useful format is found. For example: ``` - const clipboardItems = await navigator.clipboard.read(); for (const clipboardItem of clipboardItems) { -for (const type of clipboardItem.types) { + for (const type of clipboardItem.types) { if (type === 'image/png') { @@ -302,7 +296,7 @@ for (const type of clipboardItem.types) { } -} + } } @@ -315,7 +309,6 @@ The code can be [downloaded from GitHub](https://github.com/sitepoint-editors/c This works in a similar way to the text demonstration, in that copy and paste buttons must point to DOM elements using a CSS selector in `data-copyblob` and `data-pasteblob` attributes. For example: ``` - any image @@ -342,25 +335,24 @@ The `cut`, `copy`, and `paste` events fire whenever the user initiates a cli The following function forces all cut or copied text to be uppercase. Note that `e.preventDefault()` stops the default cut/copy action which would override it: ``` - body.addEventListener('cut', cutCopyHandler); body.addEventListener('copy', cutCopyHandler); // cut or copy event handler function cutCopyHandler(e) { -const selection = document.getSelection(); + const selection = document.getSelection(); -// send uppercase text to clipboard -e.clipboardData.setData( -'text/plain', -selection.toString().toUpperCase() -); + // send uppercase text to clipboard + e.clipboardData.setData( + 'text/plain', + selection.toString().toUpperCase() + ); -if (e.type === 'cut') selection.deleteFromDocument(); + if (e.type === 'cut') selection.deleteFromDocument(); -// stop default cut/copy -e.preventDefault(); + // stop default cut/copy + e.preventDefault(); } @@ -369,22 +361,18 @@ e.preventDefault(); The following code attaches a paste handler to a specific `