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 ---
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 @@
element = DocumentOrShadowRoot.activeElement+ class="brush: js notranslate">element = document.activeElement
{{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 @@This interface also inherits from the {{DOMxRef("Node")}} and {{DOMxRef("EventTarget")}} interfaces.
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.
The activeElement
read-only property of the
+{{domxref("ShadowRoot")}} interface returns the element within the shadow tree that has focus.
shadowRoot.activeElement+ +
The {{domxref('Element')}} which currently has focus, or null
if there is no focused element.
let customElem = document.querySelector('my-shadow-dom-element'); +let shadow = customElem.shadowRoot; +let focusedElem = shadow.activeElement;+ +
Specification | +
---|
{{SpecName('HTML WHATWG','#dom-documentorshadowroot-activeelement', 'activeElement')}} | +
{{Compat("api.ShadowRoot.activeElement")}}
+ +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.
:active