ElementInternals.webidl (2054B)
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 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 5 * 6 * The origin of this IDL file is 7 * https://html.spec.whatwg.org/#elementinternals 8 */ 9 10 [Exposed=Window] 11 interface ElementInternals { 12 // Shadow root access 13 readonly attribute ShadowRoot? shadowRoot; 14 15 // Form-associated custom elements 16 [Throws] 17 undefined setFormValue((File or USVString or FormData)? value, 18 optional (File or USVString or FormData)? state); 19 20 [Throws] 21 readonly attribute HTMLFormElement? form; 22 23 [Throws] 24 undefined setValidity(optional ValidityStateFlags flags = {}, 25 optional DOMString message, 26 optional HTMLElement anchor); 27 [Throws] 28 readonly attribute boolean willValidate; 29 [Throws] 30 readonly attribute ValidityState validity; 31 [Throws] 32 readonly attribute DOMString validationMessage; 33 [Throws] 34 boolean checkValidity(); 35 [Throws] 36 boolean reportValidity(); 37 38 [Throws] 39 readonly attribute NodeList labels; 40 41 [SameObject] readonly attribute CustomStateSet states; 42 }; 43 44 [Exposed=Window] 45 interface CustomStateSet { 46 setlike<DOMString>; 47 }; 48 49 partial interface CustomStateSet { 50 // Setlike methods need to be overriden. 51 [Throws] 52 undefined add(DOMString state); 53 54 [Throws] 55 boolean delete(DOMString state); 56 57 [Throws] 58 undefined clear(); 59 }; 60 61 partial interface ElementInternals { 62 [ChromeOnly, Throws] 63 readonly attribute HTMLElement? validationAnchor; 64 }; 65 66 ElementInternals includes ARIAMixin; 67 68 dictionary ValidityStateFlags { 69 boolean valueMissing = false; 70 boolean typeMismatch = false; 71 boolean patternMismatch = false; 72 boolean tooLong = false; 73 boolean tooShort = false; 74 boolean rangeUnderflow = false; 75 boolean rangeOverflow = false; 76 boolean stepMismatch = false; 77 boolean badInput = false; 78 boolean customError = false; 79 };