--- title: ShadowRoot.innerHTML slug: Web/API/ShadowRoot/innerHTML tags: - ShadowRoot.innerHTML translation_of: Web/API/ShadowRoot/innerHTML ---
{{SeeCompatTable}}{{APIRef("Shadow DOM")}}
{{domxref("ShadowRoot")}} 接口的 innerHTML
属性设置或返回 ShadowRoot内的DOM树。
let domString = shadowRoot.innerHTML // 返回 shadowRoot.innerHTML = domString; // 设置
一个 {{domxref("DOMString")}}.
Specification | Status | Comment |
---|---|---|
{{SpecName('Shadow DOM','#widl-ShadowRoot-innerHTML','ShadowRoot.innerHTML')}} | {{Spec2('Shadow DOM')}} | Initial definition. |
{{CompatibilityTable}}
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | 53 | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | 40 | 10 |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 53 | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | 40 | 10.1 |