sanitizer-api.idl (2118B)
1 // GENERATED CONTENT - DO NOT EDIT 2 // Content was automatically extracted by Reffy into webref 3 // (https://github.com/w3c/webref) 4 // Source: HTML Sanitizer API (https://wicg.github.io/sanitizer-api/) 5 6 enum SanitizerPresets { "default" }; 7 dictionary SetHTMLOptions { 8 (Sanitizer or SanitizerConfig or SanitizerPresets) sanitizer = "default"; 9 }; 10 dictionary SetHTMLUnsafeOptions { 11 (Sanitizer or SanitizerConfig or SanitizerPresets) sanitizer = {}; 12 }; 13 14 [Exposed=Window] 15 interface Sanitizer { 16 constructor(optional (SanitizerConfig or SanitizerPresets) configuration = "default"); 17 18 // Query configuration: 19 SanitizerConfig get(); 20 21 // Modify a Sanitizer’s lists and fields: 22 boolean allowElement(SanitizerElementWithAttributes element); 23 boolean removeElement(SanitizerElement element); 24 boolean replaceElementWithChildren(SanitizerElement element); 25 boolean allowAttribute(SanitizerAttribute attribute); 26 boolean removeAttribute(SanitizerAttribute attribute); 27 boolean setComments(boolean allow); 28 boolean setDataAttributes(boolean allow); 29 30 // Remove markup that executes script. 31 boolean removeUnsafe(); 32 }; 33 34 dictionary SanitizerElementNamespace { 35 required DOMString name; 36 DOMString? _namespace = "http://www.w3.org/1999/xhtml"; 37 }; 38 39 // Used by "elements" 40 dictionary SanitizerElementNamespaceWithAttributes : SanitizerElementNamespace { 41 sequence<SanitizerAttribute> attributes; 42 sequence<SanitizerAttribute> removeAttributes; 43 }; 44 45 typedef (DOMString or SanitizerElementNamespace) SanitizerElement; 46 typedef (DOMString or SanitizerElementNamespaceWithAttributes) SanitizerElementWithAttributes; 47 48 dictionary SanitizerAttributeNamespace { 49 required DOMString name; 50 DOMString? _namespace = null; 51 }; 52 typedef (DOMString or SanitizerAttributeNamespace) SanitizerAttribute; 53 54 dictionary SanitizerConfig { 55 sequence<SanitizerElementWithAttributes> elements; 56 sequence<SanitizerElement> removeElements; 57 sequence<SanitizerElement> replaceWithChildrenElements; 58 59 sequence<SanitizerAttribute> attributes; 60 sequence<SanitizerAttribute> removeAttributes; 61 62 boolean comments; 63 boolean dataAttributes; 64 };