assignedElements()
特性为
HTMLSlotElement
interface returns a sequence of the elements assigned to this slot (and no other nodes). If the
flatten
option is set to
true
, it also returns the assigned elements of any other slots that are descendants of this slot. If no assigned nodes are found, it returns the slot's fallback content.
var assignedElements = HTMLSlotElement.assignedElements(options)
flatten
: A
布尔
indicating whether to return the assigned elements of any available child
<slot>
elements (
true
) 或不 (
false
). Defaults to
false
.
An array of elements.
let slots = this.shadowRoot.querySelector('slot');
let elements = slots.assignedElements({flatten: true});
| 规范 | 状态 | 注释 |
|---|---|---|
|
HTML 实时标准
The definition of 'assignedElements()' in that specification. |
实时标准 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
assignedElements
|
Chrome 65 | Edge 79 | Firefox 66 | IE 不支持 No | Opera Yes | Safari ? | WebView Android 65 | Chrome Android 65 | Firefox Android 66 | Opera Android Yes | Safari iOS ? | Samsung Internet Android 9.0 |
完整支持
不支持
兼容性未知
实验。期望将来行为有所改变。
HTMLSlotElement
assignedElements()
assignedNodes()