diff --git a/files/en-us/_redirects.txt b/files/en-us/_redirects.txt index 7988a83b459b79c..0381998aaf9a491 100644 --- a/files/en-us/_redirects.txt +++ b/files/en-us/_redirects.txt @@ -1878,7 +1878,7 @@ /en-US/docs/DOM/dispatchEvent_example /en-US/docs/Web/Guide/Events/Creating_and_triggering_events /en-US/docs/DOM/document /en-US/docs/Web/API/Document /en-US/docs/DOM/document.URL /en-US/docs/Web/API/Document/URL -/en-US/docs/DOM/document.activeElement /en-US/docs/Web/API/DocumentOrShadowRoot/activeElement +/en-US/docs/DOM/document.activeElement /en-US/docs/Web/API/Document/activeElement /en-US/docs/DOM/document.addEventListener /en-US/docs/Web/API/EventTarget/addEventListener /en-US/docs/DOM/document.alinkColor /en-US/docs/Web/API/Document/alinkColor /en-US/docs/DOM/document.anchors /en-US/docs/Web/API/Document/anchors @@ -2419,7 +2419,7 @@ /en-US/docs/DOM:dispatchEvent_example /en-US/docs/Web/Guide/Events/Creating_and_triggering_events /en-US/docs/DOM:document /en-US/docs/Web/API/Document /en-US/docs/DOM:document.URL /en-US/docs/Web/API/Document/URL -/en-US/docs/DOM:document.activeElement /en-US/docs/Web/API/DocumentOrShadowRoot/activeElement +/en-US/docs/DOM:document.activeElement /en-US/docs/Web/API/Document/activeElement /en-US/docs/DOM:document.alinkColor /en-US/docs/Web/API/Document/alinkColor /en-US/docs/DOM:document.anchors /en-US/docs/Web/API/Document/anchors /en-US/docs/DOM:document.applets /en-US/docs/Web/API/Document/applets @@ -3250,7 +3250,7 @@ /en-US/docs/Document_Object_Model_(DOM)/cssMediaRule /en-US/docs/Web/API/CSSMediaRule /en-US/docs/Document_Object_Model_(DOM)/dispatchEvent_example /en-US/docs/Web/Guide/Events/Creating_and_triggering_events /en-US/docs/Document_Object_Model_(DOM)/document.URL /en-US/docs/Web/API/Document/URL -/en-US/docs/Document_Object_Model_(DOM)/document.activeElement /en-US/docs/Web/API/DocumentOrShadowRoot/activeElement +/en-US/docs/Document_Object_Model_(DOM)/document.activeElement /en-US/docs/Web/API/Document/activeElement /en-US/docs/Document_Object_Model_(DOM)/document.alinkColor /en-US/docs/Web/API/Document/alinkColor /en-US/docs/Document_Object_Model_(DOM)/document.anchors /en-US/docs/Web/API/Document/anchors /en-US/docs/Document_Object_Model_(DOM)/document.applets /en-US/docs/Web/API/Document/applets @@ -7509,7 +7509,6 @@ /en-US/docs/Web/API/Document/Document:_DOMContentLoaded_event /en-US/docs/Web/API/Document/DOMContentLoaded_event /en-US/docs/Web/API/Document/Document:_paste_event /en-US/docs/Web/API/Document/paste_event /en-US/docs/Web/API/Document/ParentNode.querySelectorAll /en-US/docs/Web/API/ParentNode/querySelectorAll -/en-US/docs/Web/API/Document/activeElement /en-US/docs/Web/API/DocumentOrShadowRoot/activeElement /en-US/docs/Web/API/Document/async /en-US/docs/Web/API/XMLDocument/async /en-US/docs/Web/API/Document/baseURI /en-US/docs/Web/API/Node/baseURI /en-US/docs/Web/API/Document/cancelFullscreen /en-US/docs/Web/API/Document/exitFullscreen @@ -7567,6 +7566,7 @@ /en-US/docs/Web/API/DocumentFragment/children /en-US/docs/Web/API/ParentNode/children /en-US/docs/Web/API/DocumentFragment/firstElementChild /en-US/docs/Web/API/ParentNode/firstElementChild /en-US/docs/Web/API/DocumentFragment/lastElementChild /en-US/docs/Web/API/ParentNode/lastElementChild +/en-US/docs/Web/API/DocumentOrShadowRoot/activeElement /en-US/docs/Web/API/Document/activeElement /en-US/docs/Web/API/DocumentOrShadowRoot/nodeFromPoint /en-US/docs/Web/API/DocumentOrShadowRoot /en-US/docs/Web/API/DocumentOrShadowRoot/nodesFromPoint /en-US/docs/Web/API/DocumentOrShadowRoot /en-US/docs/Web/API/DocumentOrShadowRoot/pictureInPictureEnabled /en-US/docs/Web/API/DocumentOrShadowRoot/pictureInPictureElement @@ -9249,7 +9249,7 @@ /en-US/docs/Web/API/console.trace /en-US/docs/Web/API/Console/trace /en-US/docs/Web/API/console.warn /en-US/docs/Web/API/Console/warn /en-US/docs/Web/API/document.URL /en-US/docs/Web/API/Document/URL -/en-US/docs/Web/API/document.activeElement /en-US/docs/Web/API/DocumentOrShadowRoot/activeElement +/en-US/docs/Web/API/document.activeElement /en-US/docs/Web/API/Document/activeElement /en-US/docs/Web/API/document.adoptNode /en-US/docs/Web/API/Document/adoptNode /en-US/docs/Web/API/document.alinkColor /en-US/docs/Web/API/Document/alinkColor /en-US/docs/Web/API/document.anchors /en-US/docs/Web/API/Document/anchors diff --git a/files/en-us/_wikihistory.json b/files/en-us/_wikihistory.json index 37cd708fe1505da..7698bd1f706f00f 100644 --- a/files/en-us/_wikihistory.json +++ b/files/en-us/_wikihistory.json @@ -44326,25 +44326,6 @@ "david_ross" ] }, - "Web/API/DocumentOrShadowRoot/activeElement": { - "modified": "2020-10-15T21:49:26.859Z", - "contributors": [ - "alattalatta", - "mfluehr", - "sideshowbarker", - "krosylight", - "Konrud", - "chrisdavidmills", - "spencer523", - "Sheppy", - "Volker-E", - "jpmedley", - "u_7cc", - "fscholz", - "bede", - "david_ross" - ] - }, "Web/API/DocumentOrShadowRoot/caretPositionFromPoint": { "modified": "2020-10-15T21:49:27.908Z", "contributors": [ @@ -165885,5 +165866,24 @@ "contributors": [ "sideshowbarker" ] + }, + "Web/API/Document/activeElement": { + "modified": "2020-10-15T21:49:26.859Z", + "contributors": [ + "alattalatta", + "mfluehr", + "sideshowbarker", + "krosylight", + "Konrud", + "chrisdavidmills", + "spencer523", + "Sheppy", + "Volker-E", + "jpmedley", + "u_7cc", + "fscholz", + "bede", + "david_ross" + ] } -} +} \ No newline at end of file diff --git a/files/en-us/web/api/documentorshadowroot/activeelement/index.html b/files/en-us/web/api/document/activeelement/index.html similarity index 86% rename from files/en-us/web/api/documentorshadowroot/activeelement/index.html rename to files/en-us/web/api/document/activeelement/index.html index c0cf1fc9aab354d..0be5d65af804103 100644 --- a/files/en-us/web/api/documentorshadowroot/activeelement/index.html +++ b/files/en-us/web/api/document/activeelement/index.html @@ -1,22 +1,19 @@ --- -title: DocumentOrShadowRoot.activeElement -slug: Web/API/DocumentOrShadowRoot/activeElement +title: Document.activeElement +slug: Web/API/Document/activeElement tags: -- API -- Document -- DocumentOrShadowRoot -- Focus -- Property -- Reference -- ShadowRoot -- activeElement + - API + - Document + - Focus + - Property + - Reference + - ShadowRoot + - activeElement ---
{{APIRef("Shadow DOM")}}
-

The activeElement read-only - property of the {{domxref("Document")}} and {{domxref("ShadowRoot")}} interfaces - returns the {{domxref("Element")}} within the DOM or shadow DOM tree that currently - has focus.

+

The activeElement read-only property +of the {{domxref("Document")}} interface returns the {{domxref("Element")}} within the DOM that currently has focus.

Often activeElement will return a {{domxref("HTMLInputElement")}} or {{domxref("HTMLTextAreaElement")}} object if it has the text selection at the time. If @@ -41,7 +38,7 @@

Syntax

element = DocumentOrShadowRoot.activeElement
+ class="brush: js notranslate">element = document.activeElement

Value

@@ -105,4 +102,4 @@

Specifications

Browser compatibility

-

{{Compat("api.DocumentOrShadowRoot.activeElement")}}

+

{{Compat("api.Document.activeElement")}}

diff --git a/files/en-us/web/api/document/index.html b/files/en-us/web/api/document/index.html index 34e4842894c2f97..6b7f8bea6605343 100644 --- a/files/en-us/web/api/document/index.html +++ b/files/en-us/web/api/document/index.html @@ -28,6 +28,8 @@

Properties

This interface also inherits from the {{DOMxRef("Node")}} and {{DOMxRef("EventTarget")}} interfaces.

+
{{DOMxRef("Document.activeElement")}} {{ReadOnlyInline}}
+
Returns the {{DOMxRef('Element')}} that currently has focus.
{{DOMxRef("Document.body")}}
Returns the {{HTMLElement("body")}} or {{htmlelement("frameset")}} node of the current document.
{{DOMxRef("Document.characterSet")}}{{ReadOnlyInline}}
@@ -116,8 +118,6 @@

Properties included from

The Document interface includes the following properties defined on the {{DOMxRef("DocumentOrShadowRoot")}} mixin. Note that this is currently only implemented by Chrome; other browsers still implement them directly on the {{DOMxRef("Document")}} interface.

-
{{DOMxRef("DocumentOrShadowRoot.activeElement")}}{{ReadOnlyInline}}
-
Returns the {{DOMxRef('Element')}} within the shadow tree that has focus.
{{DOMxRef("Document.fullscreenElement")}}{{ReadOnlyInline}}
The element that's currently in full screen mode for this document.
{{DOMxRef("DocumentOrShadowRoot.pointerLockElement")}} {{Experimental_Inline}}{{ReadOnlyInline}}
diff --git a/files/en-us/web/api/shadowroot/activeelement/index.html b/files/en-us/web/api/shadowroot/activeelement/index.html new file mode 100644 index 000000000000000..70ef192e6146058 --- /dev/null +++ b/files/en-us/web/api/shadowroot/activeelement/index.html @@ -0,0 +1,54 @@ +--- +title: ShadowRoot.activeElement +slug: Web/API/ShadowRoot/activeElement +tags: +- API +- Property +- Reference +- ShadowRoot +- Web Components +- shadow dom +--- +
{{APIRef("Shadow DOM")}}
+ +

The activeElement read-only property of the +{{domxref("ShadowRoot")}} interface returns the element within the shadow tree that has focus.

+ +

Syntax

+ +
shadowRoot.activeElement
+ +

Value

+ +

The {{domxref('Element')}} which currently has focus, or null if there is no focused element.

+ +

Examples

+ +
let customElem = document.querySelector('my-shadow-dom-element');
+let shadow = customElem.shadowRoot;
+let focusedElem = shadow.activeElement;
+ +

Specifications

+ + + + + + + + + + + + +
Specification
{{SpecName('HTML WHATWG','#dom-documentorshadowroot-activeelement', 'activeElement')}}
+ +

Browser compatibility

+ +

{{Compat("api.ShadowRoot.activeElement")}}

+ +

See also

+ +
    +
  • {{domxref("Document.activeElement")}}
  • +
diff --git a/files/en-us/web/api/shadowroot/index.html b/files/en-us/web/api/shadowroot/index.html index 128b090f0fc0f60..12826eb163eec86 100644 --- a/files/en-us/web/api/shadowroot/index.html +++ b/files/en-us/web/api/shadowroot/index.html @@ -18,6 +18,8 @@

Properties

+
{{domxref("ShadowRoot.activeElement")}} {{readonlyInline}}
+
Returns the {{domxref('Element')}} within the shadow tree that has focus.
{{domxref("ShadowRoot.delegatesFocus")}} {{readonlyinline}} {{non-standard_inline}}
Returns a boolean that indicates whether delegatesFocus was set when the shadow was attached (see {{domxref("Element.attachShadow()")}}).
{{domxref("ShadowRoot.host")}} {{readonlyinline}}
@@ -33,8 +35,6 @@

Properties included from

The ShadowRoot interface includes the following properties defined on the {{domxref("DocumentOrShadowRoot")}} mixin. Note that this is currently only implemented by Chrome; other browsers still implement them on the {{domxref("Document")}} interface.

-
{{domxref("DocumentOrShadowRoot.activeElement")}} {{readonlyInline}}
-
Returns the {{domxref('Element')}} within the shadow tree that has focus.
{{domxref("DocumentOrShadowRoot.styleSheets")}} {{readonlyInline}}
Returns a {{domxref('StyleSheetList')}} of {{domxref('CSSStyleSheet')}} objects for stylesheets explicitly linked into, or embedded in a document.
diff --git a/files/en-us/web/css/_colon_-moz-window-inactive/index.html b/files/en-us/web/css/_colon_-moz-window-inactive/index.html index 31f191053cb4a88..0342703fa565ca2 100644 --- a/files/en-us/web/css/_colon_-moz-window-inactive/index.html +++ b/files/en-us/web/css/_colon_-moz-window-inactive/index.html @@ -66,5 +66,5 @@

See also

  • :active
  • -
  • The {{domxref("DocumentOrShadowRoot.activeElement", "activeElement")}} property on documents and shadow DOM roots
  • +
  • The {{domxref("Document.activeElement")}} property for regular DOM, and the {{domxref("ShadowRoot.activeElement")}} property for shadow DOM roots.