HTMLSlotElement
Shadow DOM API 的接口 HTMLSlotElement 使其能够访问到 HTML 元素 <slot> 的名字和分配的节点
属性
HTMLSlotElement.name
-
DOMString
: 可以用来设置和获取 slot 的名字
方法
HTMLSlotElement.assignedNodes()
(en-US)-
Returns the sequence of elements assigned to this slot, or alternatively the slot's fallback content.
规范
Specification |
---|
HTML Standard # htmlslotelement |
浏览器的兼容性
BCD tables only load in the browser