Skip to content

Commit 84ac18a

Browse files
committed
[css-cascade] Split declaration and supports-condition in grammar, per SimonSapin's suggestion
1 parent 64e35f6 commit 84ac18a

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

css-cascade/Overview.bs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,13 @@ Importing Style Sheets: the ''@import'' rule</h2>
6868
or else the ''@import'' rule is invalid.
6969
The syntax of ''@import'' is:
7070

71-
<pre class='prod'>@import [ <<url>> | <<string>> ] [ supports( <<supports-condition>> ) ]? <<media-query-list>>? ;</pre>
71+
<pre class='prod'>
72+
@import [ <<url>> | <<string>> ]
73+
[ supports( [ <<supports-condition>> | <<declaration>> ] ) ]?
74+
<<media-query-list>>? ;</pre>
7275

7376
where the <<url>> or <<string>> gives the URL of the style sheet to be imported,
74-
and the optional <<supports-condition>> and <<media-query-list>>
77+
and the optional [<<supports-condition>>|<<declaration>>] and <<media-query-list>>
7578
(collectively, the <dfn>import conditions</dfn>)
7679
state the conditions under which it applies.
7780

@@ -128,10 +131,23 @@ Conditional ''@import'' Rules</h3>
128131
</pre>
129132
</div>
130133

131-
A <dfn><<media-query>></dfn> corresponds to the <code>media_query_list</code> production and is interpreted as a <a>media query</a>,
132-
and a <dfn><<supports-condition>></dfn> corresponds to either a <code>supports_condition</code> production
133-
or a <code>declaration</code> production interpreted as a <code>supports_declaration_condition</code> production
134+
A <dfn><<media-query>></dfn> corresponds to the <code>media_query_list</code> production
135+
and is interpreted as a <a>media query</a>,
136+
and a <dfn><<supports-condition>></dfn> corresponds to a <code>supports_condition</code> production
134137
and is interpreted as an ''@supports'' condition.
138+
If a <dfn><<declaration>></dfn> (a <code>declaration</code> production) is given in place of a <<supports-condition>>,
139+
it must be interpreted as a <code>supports_declaration_condition</code> production
140+
(i.e. the extra set of parentheses is implied)
141+
and treated as a <<supports-condition>>.
142+
143+
<div class="example">
144+
For example, the following two lines are equivalent:
145+
<pre class='lang-css'>
146+
@import "mystyle.css" supports(display: flex);
147+
@import "mystyle.css" supports((display: flex));
148+
</pre>
149+
</div>
150+
135151
The evaluation and full syntax of the <a>import conditions</a>
136152
are defined by the <a href="http://www.w3.org/TR/css3-mediaqueries/">Media Queries</a> [[!MEDIAQ]]
137153
and <a href="http://www.w3.org/TR/css-conditional/">CSS Conditional Rules</a> [[!CSS3-CONDITIONAL]] specifications.

0 commit comments

Comments
 (0)