1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html
9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
10 * liability, trademark and document use rules apply.
13 // https://dom.spec.whatwg.org/#enumdef-shadowrootmode
19 enum SlotAssignmentMode { "manual", "named" };
21 // https://dom.spec.whatwg.org/#shadowroot
23 InstrumentedProps=(pictureInPictureElement)]
24 interface ShadowRoot : DocumentFragment
27 readonly attribute ShadowRootMode mode;
28 readonly attribute boolean delegatesFocus;
29 readonly attribute SlotAssignmentMode slotAssignment;
30 [Pref="dom.webcomponents.shadowdom.declarative.enabled"]
31 readonly attribute boolean clonable;
32 readonly attribute Element host;
33 attribute EventHandler onslotchange;
35 Element? getElementById(DOMString elementId);
37 // https://w3c.github.io/DOM-Parsing/#the-innerhtml-mixin
38 [CEReactions, SetterThrows]
39 attribute [LegacyNullToEmptyString] DOMString innerHTML;
41 // When JS invokes importNode or createElement, the binding code needs to
42 // create a reflector, and so invoking those methods directly on the content
43 // document would cause the reflector to be created in the content scope,
44 // at which point it would be difficult to move into the UA Widget scope.
45 // As such, these methods allow UA widget code to simultaneously create nodes
46 // and associate them with the UA widget tree, so that the reflectors get
47 // created in the right scope.
48 [CEReactions, Throws, Func="IsChromeOrUAWidget"]
49 Node importNodeAndAppendChildAt(Node parentNode, Node node, optional boolean deep = false);
51 [CEReactions, Throws, Func="IsChromeOrUAWidget"]
52 Node createElementAndAppendChildAt(Node parentNode, DOMString localName);
54 // For triggering UA Widget scope in tests.
56 undefined setIsUAWidget();
61 partial interface ShadowRoot {
62 // https://html.spec.whatwg.org/#dom-shadowroot-sethtmlunsafe
63 [Pref="dom.webcomponents.shadowdom.declarative.enabled"]
64 undefined setHTMLUnsafe(DOMString html);
67 ShadowRoot includes DocumentOrShadowRoot;