CSSStyleSheet.webidl (1706B)
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/. 5 * 6 * The origin of this IDL file is 7 * http://dev.w3.org/csswg/cssom/ 8 * https://wicg.github.io/construct-stylesheets/ 9 */ 10 11 enum CSSStyleSheetParsingMode { 12 "author", 13 "user", 14 "agent" 15 }; 16 17 dictionary CSSStyleSheetInit { 18 (MediaList or UTF8String) media = ""; 19 boolean disabled = false; 20 UTF8String baseURL; 21 }; 22 23 [Exposed=Window] 24 interface CSSStyleSheet : StyleSheet { 25 [Throws] 26 constructor(optional CSSStyleSheetInit options = {}); 27 [Pure, BinaryName="DOMOwnerRule"] 28 readonly attribute CSSRule? ownerRule; 29 [Throws, NeedsSubjectPrincipal] 30 readonly attribute CSSRuleList cssRules; 31 [ChromeOnly, BinaryName="parsingModeDOM"] 32 readonly attribute CSSStyleSheetParsingMode parsingMode; 33 [Throws, NeedsSubjectPrincipal] 34 unsigned long insertRule(UTF8String rule, optional unsigned long index = 0); 35 [Throws, NeedsSubjectPrincipal] 36 undefined deleteRule(unsigned long index); 37 [NewObject] 38 Promise<CSSStyleSheet> replace(UTF8String text); 39 [Throws] 40 undefined replaceSync(UTF8String text); 41 42 // Non-standard WebKit things. 43 [Throws, NeedsSubjectPrincipal, BinaryName="cssRules"] 44 readonly attribute CSSRuleList rules; 45 [Throws, NeedsSubjectPrincipal, BinaryName="deleteRule"] 46 undefined removeRule(optional unsigned long index = 0); 47 [Throws, NeedsSubjectPrincipal] 48 long addRule(optional UTF8String selector = "undefined", optional UTF8String style = "undefined", optional unsigned long index); 49 };