CustomElementRegistry.webidl (3212B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 // https://html.spec.whatwg.org/#dom-window-customelements 6 [Exposed=Window] 7 interface CustomElementRegistry { 8 [CEReactions, Throws, UseCounter] 9 undefined define(DOMString name, CustomElementConstructor constructor, 10 optional ElementDefinitionOptions options = {}); 11 [ChromeOnly, Throws] 12 undefined setElementCreationCallback(DOMString name, CustomElementCreationCallback callback); 13 (CustomElementConstructor or undefined) get(DOMString name); 14 DOMString? getName(CustomElementConstructor constructor); 15 [Throws] 16 Promise<CustomElementConstructor> whenDefined(DOMString name); 17 [CEReactions] undefined upgrade(Node root); 18 }; 19 20 dictionary ElementDefinitionOptions { 21 DOMString extends; 22 }; 23 24 enum RestoreReason { 25 "restore", 26 "autocomplete", 27 }; 28 29 callback constructor CustomElementConstructor = any (); 30 31 [MOZ_CAN_RUN_SCRIPT_BOUNDARY] 32 callback CustomElementCreationCallback = undefined (DOMString name); 33 34 [MOZ_CAN_RUN_SCRIPT_BOUNDARY] 35 callback LifecycleConnectedCallback = undefined(); 36 [MOZ_CAN_RUN_SCRIPT_BOUNDARY] 37 callback LifecycleDisconnectedCallback = undefined(); 38 [MOZ_CAN_RUN_SCRIPT_BOUNDARY] 39 callback LifecycleAdoptedCallback = undefined(Document? oldDocument, 40 Document? newDocment); 41 [MOZ_CAN_RUN_SCRIPT_BOUNDARY] 42 callback LifecycleConnectedMoveCallback = undefined(); 43 [MOZ_CAN_RUN_SCRIPT_BOUNDARY] 44 callback LifecycleAttributeChangedCallback = undefined(DOMString attrName, 45 DOMString? oldValue, 46 DOMString? newValue, 47 DOMString? namespaceURI); 48 [MOZ_CAN_RUN_SCRIPT_BOUNDARY] 49 callback LifecycleFormAssociatedCallback = undefined(HTMLFormElement? form); 50 [MOZ_CAN_RUN_SCRIPT_BOUNDARY] 51 callback LifecycleFormResetCallback = undefined(); 52 [MOZ_CAN_RUN_SCRIPT_BOUNDARY] 53 callback LifecycleFormDisabledCallback = undefined(boolean disabled); 54 [MOZ_CAN_RUN_SCRIPT_BOUNDARY] 55 callback LifecycleFormStateRestoreCallback = undefined((File or USVString or FormData)? state, RestoreReason reason); 56 [MOZ_CAN_RUN_SCRIPT_BOUNDARY] 57 callback LifecycleGetCustomInterfaceCallback = object?(any iid); 58 59 // Unsorted is necessary until https://github.com/whatwg/html/issues/3580 is resolved. 60 [GenerateInit, Unsorted] 61 dictionary LifecycleCallbacks { 62 LifecycleConnectedCallback connectedCallback; 63 LifecycleDisconnectedCallback disconnectedCallback; 64 LifecycleConnectedMoveCallback connectedMoveCallback; 65 LifecycleAdoptedCallback adoptedCallback; 66 LifecycleAttributeChangedCallback attributeChangedCallback; 67 [ChromeOnly] LifecycleGetCustomInterfaceCallback getCustomInterfaceCallback; 68 }; 69 70 [GenerateInit, Unsorted] 71 dictionary FormAssociatedLifecycleCallbacks { 72 LifecycleFormAssociatedCallback formAssociatedCallback; 73 LifecycleFormResetCallback formResetCallback; 74 LifecycleFormDisabledCallback formDisabledCallback; 75 LifecycleFormStateRestoreCallback formStateRestoreCallback; 76 };