@@ -871,11 +871,11 @@ Cascade Sorting Order</h3>
871871 any declaration not assigned to an explicit layer is added to an implicit final layer.
872872
873873 When comparing declarations that belong to different layers,
874- then for [=normal=] rules the last declaration whose [=cascade layer=] is last wins,
874+ then for [=normal=] rules the declaration whose [=cascade layer=] is last wins,
875875 and for [=important=] rules the declaration whose [=cascade layer=] is first wins.
876876
877877 Note: This follows the same logic used for layering [=normal=] and [=important=] [=origins=] ,
878- so that ''!important'' maintains the same semantic purpose.
878+ so that the ''!important'' flag maintains the same semantic purpose in both settings .
879879
880880 Issue(w3c/csswg-drafts#5003): Where do Layers fit in the cascade?
881881
@@ -1039,7 +1039,8 @@ Cascade Layers</h3>
10391039 <dfn export>Cascade Layers</dfn> provide an explicit way
10401040 to balance concerns within a single origin.
10411041 Authors can create layers to represent element defaults,
1042- third-party libraries, themes, components, overrides, and other styling concerns --
1042+ third-party libraries, themes, components,
1043+ overrides, and other styling concerns --
10431044 and re-order the cascade of layers in a deterministic way,
10441045 without altering selectors or specificity within each layer,
10451046 or relying on source-order to resolve conflicts across layers.
@@ -1074,22 +1075,38 @@ Layering Styles: the ''@layer'' rule</h4>
10741075 The <dfn at-rule id="at-ruledef-layer">@layer</dfn> rule
10751076 describes an explicit [=cascade layer=] ,
10761077 with the option to assign style rules as either a block or an import.
1077- The syntax is:
1078+
1079+ The import syntax is:
10781080
10791081 <pre class='prod'>
1080- @layer [ <<layer-ident>> ? [ <<url>> ; | {
1082+ @layer <<layer-ident>> ? <<url>> ;
1083+ </pre>
1084+
1085+ Issue(w3c/csswg-drafts#5681): Is ''@layer'' the proper way to handle layered url imports?
1086+
1087+ The block syntax is:
1088+
1089+ <pre class='prod'>
1090+ @layer <<layer-ident>> ? {
10811091 <<stylesheet>>
1082- } ]? ]!
1092+ }
10831093 </pre>
10841094
1085- where the optional <dfn><<layer-ident>></dfn> is a
1095+ In both cases the optional <dfn><<layer-ident>></dfn> is a
10861096 CSS <a href="https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier">identifier</a>
1087- that either matches an existing layer name, or defines a new named layer,
1088- the optional [<<url>>;|{<<stylesheet>>}]
1089- either gives the URL of the style sheet to be imported into that layer,
1090- or contains style rules to be added to the layer.
1097+ that either matches an existing layer name, or defines a new named layer.
1098+ If no identifier is given, a new unnamed layer is created.
1099+ The '<<url>>' import or '<<stylesheet>>' block
1100+ provides a arbitrary CSS rules that will be appended to the layer.
10911101
1092- Issue(w3c/csswg-drafts#5681): Is ''@layer'' the proper way to handle layered url imports?
1102+ The ''@layer'' rule can also be used to define new layers
1103+ without attaching any style rules, by providing only an identifier:
1104+
1105+ <pre class='prod'>
1106+ @layer <<layer-ident>> ;
1107+ </pre>
1108+
1109+ Issue(w3c/csswg-drafts#4969): What are the proper "levels" for managing Cascade Layers?
10931110
10941111<h5 id="layer-identifiers" class="no-toc">
10951112Layer Identifiers</h5>
@@ -1111,10 +1128,15 @@ Layer Identifiers</h5>
11111128 </pre>
11121129 </div>
11131130
1114- This also allows authors to establish a layer order in advance,
1115- regardless of the order styles are added to each layer.
1131+ The identifier-only syntax
1132+ also allows authors to establish a layer order in advance,
1133+ regardless of the order in which style rules are added to each layer.
11161134
11171135 <div class="example">
1136+ In this example, the imported ''theme.css'' style will override
1137+ any style rules added to the ''default'' ,
1138+ since the order of layers has already been established.
1139+
11181140 <pre class='lang-css'>
11191141 @layer default;
11201142 @layer theme;
@@ -1132,6 +1154,12 @@ Layer Identifiers</h5>
11321154 See also [[#at-layers]]
11331155 </div>
11341156
1157+ Layer identifiers do not cross the shadow DOM boundary,
1158+ so the ordering of layers in the light DOM has no impact
1159+ on the layer of identically-named layers in the shadow DOM.
1160+
1161+ Issue(w3c/csswg-drafts#4984): How do Cascade Layers interact with Shadow DOM?
1162+
11351163<h5 id="nested-layers" class="no-toc">
11361164Nested Layers</h5>
11371165
@@ -1180,8 +1208,6 @@ Nested Layers</h5>
11801208 from an outer scope,
11811209 by combining identifiers with a full stop (. U+002E) character.
11821210
1183- Issue: What is the appropriate syntax for nested layer identifiers?
1184-
11851211 <div class="example">
11861212 <pre class='lang-css'>
11871213 @layer framework {
@@ -1201,28 +1227,42 @@ Nested Layers</h5>
12011227 </pre>
12021228 </div>
12031229
1230+ Issue(w3c/csswg-drafts#5791): What is the appropriate syntax for appending to nested layers?
1231+
12041232<h5 id="unnamed-layers" class="no-toc">
12051233Un-Named Layers</h5>
12061234
12071235 Layers without an identifier are also added to the layer order when invoked,
1208- but only describe a single rule-block or file import --
1236+ but only describe a single rule-block or file import
12091237 without any external hook for re-arranging or adding styles.
1210- This can be used to create "private" layers
1211- that should not be manipulated or re-ordered
1212- by other layer rules.
1238+
12131239
12141240 <div class="example">
1215- In the following example,
1216- additional styles can be added to the ''default'' layer,
1217- but not the layer containing ''framework.css'' :
1241+ In most use-cases this would only be syntax-sugar for brevity --
1242+ relying on well-organized source-order rather than any explicit names.
1243+ However, it could be used by teams as a way to "force" an organizing convention
1244+ (all layer code must be defined in one place),
1245+ or by libraries wanting to merge & hide a set of internal "private" layers
1246+ that they don't want exposed to author manipulation:
12181247
12191248 <pre class='lang-css'>
1220- @layer default url(headings.css);
1221- @layer url(framework.css);
1249+ /* bootstrap-base.css */
1250+ /* unnamed wrapper layers around each sub-file */
1251+ @layer url(base-forms.css);
1252+ @layer url(base-links.css);
1253+ @layer url(base-headings.css);
1254+
1255+ /* bootstrap.css */
1256+ /* the intrnal names are hidden from access, subsumed in "base" */
1257+ @layer base url(bootstrap-base.css);
1258+
1259+ /* author.css */
1260+ /* author has access to bootstrap.base layer, but not into unnamed layers */
1261+ @layer bootstrap url(bootstrap.css);
12221262 </pre>
12231263 </div>
12241264
1225- Issue: Should un-named layers be allowed?
1265+ Issue(w3c/csswg-drafts#5792) : Should unnamed cascade layers be allowed?
12261266
12271267<h4 id="at-layers">
12281268Layer-Ordering Shorthand: the ''@layers'' rule</h3>
@@ -1236,6 +1276,26 @@ Layer-Ordering Shorthand: the ''@layers'' rule</h3>
12361276 @layers <<custom-ident>> [, <<custom-ident>> ]* ;
12371277 </pre>
12381278
1279+ This is provided as a shorthand for establishing the order of named layers:
1280+
1281+ <div class="example">
1282+ The following examples have the same result.
1283+
1284+ Using multiple ''@layer'' rules with identifier only:
1285+
1286+ <pre class='lang-css'>
1287+ @layer default;
1288+ @layer theme;
1289+ @layer components;
1290+ </pre>
1291+
1292+ Using the ''@layers'' shorthand syntax:
1293+
1294+ <pre class='lang-css'>
1295+ @layers default, theme, components;
1296+ </pre>
1297+ </div>
1298+
12391299<h3 id="preshint">
12401300Precedence of Non-CSS Presentational Hints</h3>
12411301
0 commit comments