HTML:标记语言
CSS:样式语言
JavaScript:脚本语言
Web API:编程接口
所有 Web 技术
学习 Web 开发
发现我们的工具
更好地了解 MDN
activeElement 是 ShadowRoot 接口的只读属性,它返回阴影树中当前拥有焦点的元素。
activeElement
ShadowRoot
当前拥有焦点的 Element,如果没有元素拥有焦点则为 null。
Element
null
let customElem = document.querySelector("my-shadow-dom-element"); let shadow = customElem.shadowRoot; let focusedElem = shadow.activeElement;
加载中…
Document.activeElement