--- 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

浏览器的兼容性

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatChrome(53.0)}} {{CompatNo}} {{CompatNo}} {{CompatUnknown}} {{CompatNo}}
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support {{CompatNo}} {{CompatChrome(53.0)}} {{CompatNo}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatChrome(53.0)}}