@@ -14,7 +14,7 @@ Previous Version: http://www.w3.org/TR/2013/WD-css3-cascade-20130103/
1414Previous Version : http://www.w3.org/TR/2005/WD-css3-cascade-20051215/
1515Issue Tracking : Disposition of Comments http://dev.w3.org/csswg/css-cascade/issues
1616Abstract : This CSS module describes how to collate style rules and assign values to all properties on all elements. By way of cascading and inheritance, values are propagated for all properties on all elements.
17- Ignored Terms : auto, flex items
17+ Ignored Terms : auto, flex items, <supports-condition>
1818Link Defaults : css21 (property) display
1919</pre>
2020
@@ -40,15 +40,31 @@ Introduction</h2>
4040Importing Style Sheets: the ''@import'' rule</h2>
4141
4242 The <dfn>@import</dfn> rule allows users to import style rules from other style sheets.
43+ If an ''@import'' rule refers to a valid stylesheet,
44+ user agents must treat the contents of the stylesheet as if they were written in place of the ''@import'' rule.
45+
46+ <p class='example'>
47+ For example, declarations in style rules from imported stylesheets interact with the cascade
48+ as if they were written literally into the stylesheet at the point of the ''@import'' .
49+ Similarly, style rules in a stylesheet imported into a scoped stylesheet
50+ are scoped in the same way.
51+
4352 Any ''@import'' rules must precede all other at-rules and style rules in a style sheet
4453 (besides ''@charset'' , which must be the first thing in the style sheet if it exists),
4554 or else the ''@import'' rule is invalid.
4655 The syntax of ''@import'' is:
4756
48- <pre class='prod'>@import [ <<url>> | <<string>> ] <<media-query-list>> ? ;</pre>
57+ <pre class='prod'>@import [ <<url>> | <<string>> ] [ supports( <<supports-condition>> ) ]? <<media-query-list>> ? ;</pre>
58+
59+ Where the <<url>> or <<string>> gives the URL of the style sheet to be imported,
60+ and the optional <<supports-condition>> and <<media-query-list>>
61+ (collectively, the <dfn>import conditions</dfn> )
62+ state the conditions under which it applies.
63+
64+ Issue: Syntax for incorporating <<supports-condition>> is currently under discussion; suggestions and feedback welcome!
4965
5066 If a <<string>> is provided,
51- it must be interpreted as a url with the same value.
67+ it must be interpreted as a << url>> with the same value.
5268
5369 <div class="example">
5470 The following lines are equivalent in meaning
@@ -61,50 +77,57 @@ Importing Style Sheets: the ''@import'' rule</h2>
6177 </pre>
6278 </div>
6379
64- If an ''@import'' rule refers to a valid stylesheet,
65- user agents must treat the contents of the stylesheet as if they were written in place of the ''@import'' rule.
66-
67- <p class='example'>
68- For example, declarations in style rules from imported stylesheets interact with the cascade
69- as if they were written literally into the stylesheet at the point of the ''@import'' .
70- Similarly, style rules in a stylesheet imported into a scoped stylesheet
71- are scoped in the same way.
72-
73- An ''@import'' rule can be media-dependent:
74- such media-dependent imports include a comma-separated list of “media queries” after the URI,
75- which specify to which media the imported style sheet applies.
76- In the absence of any media query, the import is unconditional.
77- (Specifying ''@media/all'' for the medium has the same effect.)
80+ The <a>import conditions</a> allow the import to be media– or feature-support–dependent.
81+ In the absence of any <a>import conditions</a> , the import is unconditional.
82+ (Specifying ''@media/all'' for the <<media-query-list>> has the same effect.)
7883
79- The evaluation and full syntax of the expressions after the URL
80- is defined by the <a href="http://www.w3.org/TR/css3-mediaqueries/">Media Queries</a> specification [[!MEDIAQ]] .
81- If the media query does not match,
84+ The evaluation and full syntax of the <a>import conditions</a>
85+ is defined by the <a href="http://www.w3.org/TR/css3-mediaqueries/">Media Queries</a> [[!MEDIAQ]]
86+ and <a href="http://www.w3.org/TR/css-conditional/">CSS Conditional Rules</a> [[!CSS3-CONDITIONAL]] specifications.
87+ If the conditions do not match,
8288 the rules in the imported stylesheet do not apply,
83- exactly as if the imported stylesheet were wrapped in an ''@media'' block with the given media query.
84- User agents may therefore avoid fetching a media-dependent import
85- as long as the media query does not match.
89+ exactly as if the imported stylesheet were wrapped in ''@media'' and/or ''@supports'' blocks with the given conditions.
8690
8791 <div class=example>
8892 The following rules illustrate how ''@import'' rules can be made media-dependent:
8993
90- <pre>
94+ <pre class='lang-css' >
9195 @import url("fineprint.css") print;
9296 @import url("bluish.css") projection, tv;
9397 @import url("narrow.css") handheld and (max-width: 400px);
9498 </pre>
9599 </div>
96100
101+ User agents may therefore avoid fetching a conditional import
102+ as long as the <a>import conditions</a> do not match.
103+ Additionally, if a <<supports-condition>> blocks the application of the imported style sheet,
104+ the UA <em> must not</em> fetch the style sheet (unless it is loaded through some other link)
105+ and <em> must</em> return null for the import rule's CSSImportRule.styleSheet value
106+ (even if it is loaded through some other link).
107+
108+ <div class="example">
109+ The following rule illustrates how an author can provide fallback rules for legacy user agents
110+ without impacting network performance on newer user agents:
111+
112+ <pre class='lang-css'>
113+ @import url("fallback-layout.css") supports(not (display: flex));
114+ @supports (display: flex) {
115+ ...
116+ }
117+ </pre>
118+ </div>
119+
97120 When the same style sheet is imported or linked to a document in multiple places,
98121 user agents must process (or act as though they do) each link
99- as though the link were to a separate style sheet.
122+ as though the link were to an independent style sheet.
100123
101124 Note: This does not place any requirements on resource fetching,
102125 only how the style sheet is reflected in the CSSOM and used in specs such as this one.
103126 Assuming appropriate caching,
104127 it is perfectly appropriate for a UA to fetch a style sheet only once,
105128 even though it's linked or imported multiple times.
106129
107- The <a>origin</a> of an imported style sheet is the same as the <a>origin</a> of the style sheet that imported it.
130+ The <a>origin</a> of an imported style sheet is the <a>origin</a> of the style sheet that imported it.
108131
109132 The <a>environment encoding</a> of an imported style sheet is the encoding of the style sheet that imported it. [[CSS3SYN]]
110133
0 commit comments