HTMLSlotElement
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
Shadow DOM API 的接口 HTMLSlotElement 使其能够访问到 HTML 元素 <slot> 的名字和分配的节点
属性
HTMLSlotElement.name
-
DOMString
: 可以用来设置和获取 slot 的名字
方法
HTMLSlotElement.assignedNodes()
-
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