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