--- title: HTMLSlotElement slug: Web/API/HTMLSlotElement translation_of: Web/API/HTMLSlotElement ---

{{SeeCompatTable}}{{APIRef('Web Components')}}

Shadow DOM API 的接口HTMLSlotElement使其能够访问到HTML元素<slot>的名字和分配的节点

属性

{{domxref('HTMLSlotElement.name')}}
{{domxref("DOMString")}}: 可以用来设置和获取slot的名字

方法

{{domxref('HTMLSlotElement.assignedNodes()')}}
Returns the sequence of elements assigned to this slot, or alternatively the slot's fallback content.

规范

Specification Status Comment
{{SpecName('HTML WHATWG','scripting.html#htmlslotelement','HTMLSlotElement')}} {{Spec2('HTML WHATWG')}}  
{{SpecName('Shadow DOM','#the-slot-element','HTMLSlotElement')}} {{Spec2('Shadow DOM')}} Initial definition

浏览器的兼容性

{{Compat("api.HTMLSlotElement")}}