@@ -775,7 +775,7 @@ represents a style sheet as defined by the CSS specification. In the CSSOM a
775
775
</dd>
776
776
</dl>
777
777
778
- <a>CSS style sheet</a> has a number of associated state items:
778
+ A <a>CSS style sheet</a> has a number of associated state items:
779
779
780
780
<dl dfn-for="CSSStyleSheet">
781
781
<dt> <dfn id=concept-css-style-sheet-type>type</dfn>
@@ -994,8 +994,8 @@ The <dfn method for=CSSStyleSheet>insertRule(<var>rule</var>, <var>index</var>)<
994
994
<li> If the <a>disallow modification flag</a> is set, throw a {{NotAllowedError}} {{DOMException}} .
995
995
<li> Let <var> parsed rule</var> be the return value of invoking <a>parse a rule</a> with <var> rule</var> .
996
996
<li> If <var> parsed rule</var> is a syntax error, return <var> parsed rule</var> .
997
- <li> If <var> parsed rule</var> is an <a>@import</a> rule, and the <a>constructed flag</a> or any ancestor
998
- style sheet's <a>constructed flag</a> is set, throw a {{NotAllowedError }} {{DOMException}} .
997
+ <li> If <var> parsed rule</var> is an <a>@import</a> rule, and the <a>constructed flag</a> is set, throw
998
+ a {{SyntaxError }} {{DOMException}} .
999
999
<li> Return the result of invoking <a>insert a CSS rule</a> <var> rule</var> in the <a for=CSSStyleSheet>CSS rules</a>
1000
1000
at <var> index</var> .
1001
1001
</ol>
@@ -1017,36 +1017,14 @@ The <dfn method for=CSSStyleSheet>replace(<a for=CSSRule>text</a>)</dfn> method
1017
1017
<li> Set the <a>disallow modification flag</a> .
1018
1018
<li> <a>In parallel</a> , do these steps:
1019
1019
<ol>
1020
- <li> Let <var> rules</var> be the result of running <a>parse a list of rules</a> from <var> text</var> . If <var> rules</var> is not a list of rules
1021
- (i.e. an error occurred during parsing), set <var> rules</var> to an empty list.
1022
- <li> Wait for loading of <a>@import</a> rules in <var> rules|</var> and any nested <a>@import</a> s from those rules (and so on).
1023
- <ul>
1024
- <li> If any of them failed to load, <a>terminate</a> fetching of the remaining <a>@import</a> rules, and <a>queue a task</a> on the
1025
- <a>networking task source</a> to perform the following steps:
1026
- <ol>
1027
- <li> Unset <var> sheet</var> 's <a>disallow modification flag</a> .
1028
- <li> Reject <var> promise</var> with a {{NetworkError}} {{DOMException}} .
1029
- </ol>
1030
- <li> Otherwise, once all of them have finished loading, <a>queue a task</a> on the [<a>etworking task source</a> to perform the
1031
- following steps:
1032
- <ol>
1033
- <li> Set <var> sheet</var> 's <a>CSS rules</a> to <var> rules</var> .
1034
- <li> Unset <var> sheet</var> 's <a>disallow modification flag</a> .
1035
- <li> Resolve <var> promise</var> with <var> sheet</var> .
1036
- </ol>
1037
- </ul>
1038
- <p class="note">
1039
- Note: Loading of <a>@import</a> rules should follow the rules used for fetching style sheets for <a>@import</a> rules of
1040
- stylesheets from <link> elements, in regard to what counts as success, CSP, and Content-Type header checking.
1041
- </p>
1042
- <p class="note">
1043
- Note: We will use the <a>fetch group</a> of <var> sheet</var> 's <a>constructor document</a>' s <a>relevant settings object</a> for
1044
- <a>@import</a> rules and other (fonts, etc) loads.
1045
- </p>
1046
- <p class="note">
1047
- Note: The rules regarding loading mentioned above are currently not specified rigorously anywhere.
1048
- </p>
1049
- <li> Return <var> promise</var> .
1020
+ <li> Let <var> rules</var> be the result of running <a>parse a list of rules</a> from <var> text</var> . If <var> rules</var> is
1021
+ not a list of rules (i.e. an error occurred during parsing), set <var> rules</var> to an empty list.
1022
+ <li> If <var> rules</var> contains one or more <a>@import</a> rules, <a lt="remove a CSS rule">remove those rules</a> from <var> rules</var> .
1023
+ <li> Set <var> sheet</var> 's <a>CSS rules</a> to <var> rules</var> .
1024
+ <li> Unset <var> sheet</var> 's <a>disallow modification flag</a> .
1025
+ <li> Resolve <var> promise</var> with <var> sheet</var> .
1026
+ </ol>
1027
+ <li> Return <var> promise</var> .
1050
1028
</ol>
1051
1029
1052
1030
The <dfn method for=CSSStyleSheet>replaceSync(<a for=CSSRule>text</a>)</dfn> method must run the following steps:
@@ -1055,7 +1033,7 @@ The <dfn method for=CSSStyleSheet>replaceSync(<a for=CSSRule>text</a>)</dfn> met
1055
1033
{{DOMException}} .
1056
1034
<li> Let <var> rules</var> be the result of running <a>parse a list of rules</a> from <var> text</var> . If <var> rules</var> is
1057
1035
not a list of rules (i.e. an error occurred during parsing), set <var> rules</var> to an empty list.
1058
- <li> If <var> rules</var> contains one or more <a>@import</a> rules, throw a {{NotAllowedError}} {{DOMException}} .
1036
+ <li> If <var> rules</var> contains one or more <a>@import</a> rules, <a lt="remove a CSS rule">remove those rules</a> from <var> rules </var> .
1059
1037
<li> Set <a>CSS rules</a> to <var> rules</var> .
1060
1038
</ol>
1061
1039
0 commit comments