Skip to content

Commit edc1ced

Browse files
committed
[css3-cascade] Correct scoping rules to match bzbarsky's original proposal <http://www.w3.org/mid/4F570227.8060707@mit.edu>.
1 parent 01ff0be commit edc1ced

2 files changed

Lines changed: 67 additions & 25 deletions

File tree

css3-cascade/Overview.html

Lines changed: 53 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
<meta content="CSS Cascading and Inheritance Level 3" name=dcterms.title>
1313
<meta content=text name=dcterms.type>
14-
<meta content=2012-12-07 name=dcterms.issued>
14+
<meta content=2012-12-13 name=dcterms.issued>
1515
<meta content="http://dev.w3.org/csswg/css3-cascade/" name=dcterms.creator>
1616
<meta content=W3C name=dcterms.publisher>
17-
<meta content="http://www.w3.org/TR/2012/ED-css3-cascade-20121207/"
17+
<meta content="http://www.w3.org/TR/2012/ED-css3-cascade-20121213/"
1818
name=dcterms.identifier>
1919
<link href="../default.css" rel=stylesheet type="text/css">
2020
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel=stylesheet
@@ -27,14 +27,14 @@
2727

2828
<h1>CSS Cascading and Inheritance Level 3</h1>
2929

30-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 7 December
30+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 13 December
3131
2012</h2>
3232

3333
<dl>
3434
<dt>This version:
3535

3636
<dd><a
37-
href="http://www.w3.org/TR/2012/ED-css3-cascade-20121207/">http://www.w3.org/TR/2012/ED-css3-cascade-20121207/</a>
37+
href="http://www.w3.org/TR/2012/ED-css3-cascade-20121213/">http://www.w3.org/TR/2012/ED-css3-cascade-20121213/</a>
3838

3939
<dt>Latest version:
4040

@@ -516,19 +516,30 @@ <h3 id=cascade><span class=secno>4.2. </span> Cascading Declarations</h3>
516516

517517
<dt id=cascade-step-scope>Scope
518518

519-
<dd> If a declaration belongs to a ruleset with a <a
520-
href="http://www.w3.org/TR/selectors4/#scoping">scoped selector</a>, the
521-
element it is scoped to can affect the cascade. For the purpose of this
522-
step, declarations from style attributes <a href="#CSSSTYLEATTR"
519+
<dd> A declaration can be <dfn id=scoped>scoped</dfn> to a subtree of the
520+
document so that it only affects its <dfn
521+
id=scoping-element-and-that-elements-descen>scoping element<dfn
522+
id=and-that-elements-descendants.-for-examp> and that element's
523+
descendants. For example, <a href="#HTML5"
524+
rel=biblioentry>[HTML5]<!--{{HTML5}}--></a> defines scoped
525+
<code>&lt;style&gt;</code> elements, whose style sheets are scoped to the
526+
element's parent. If a declaration is <i>scoped</i>, which element it is
527+
scoped to affects the cascade. For the purpose of this step, declarations
528+
from style attributes <a href="#CSSSTYLEATTR"
523529
rel=biblioentry>[CSSSTYLEATTR]<!--{{!CSSSTYLEATTR}}--></a> are considered
524-
to be scoped to the element with the attribute, and all other
525-
declarations are considered to be scoped to the root element.
526-
<p> If the <a
527-
href="http://www.w3.org/TR/selectors4/#scoping-element">scoping
528-
elements</a> of two declarations have an ancestor/descendant
529-
relationship, the declaration whose scoping element is the descendant
530-
wins. If one declaration is from a style attribute on an element and the
531-
other is from a ruleset scoped to that element, the declaration in the
530+
to be <i>scoped</i> to the element with the attribute, and all unscoped
531+
declarations are considered to be <i>scoped</i> to the root element.
532+
</dfn></dfn>
533+
<p> If the <a href="#scoping-element-and-that-elements-descen"><i>scoping
534+
elements</i></a> of two declarations have an ancestor/descendant
535+
relationship, then for normal rules the declaration whose <a
536+
href="#scoping-element-and-that-elements-descen"><i>scoping
537+
element</i></a> is the descendant wins, and for important rules the
538+
declaration whose <a
539+
href="#scoping-element-and-that-elements-descen"><i>scoping
540+
element</i></a> is the ancestor wins. If one declaration is from a style
541+
attribute on an element and the other is from a ruleset otherwise <a
542+
href="#scoped"><i>scoped</i></a> to that element, the declaration in the
532543
style attribute wins.
533544

534545
<dt id=cascade-step-specificity>Specificity
@@ -1117,10 +1128,10 @@ <h3 class=no-num id=normative-references>Normative references</h3>
11171128
<dt id=DOM-LEVEL-2-STYLE>[DOM-LEVEL-2-STYLE]
11181129

11191130
<dd>Chris Wilson; Philippe Le Hégaret; Vidur Apparao. <a
1120-
href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113"><cite>Document
1131+
href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/"><cite>Document
11211132
Object Model (DOM) Level 2 Style Specification.</cite></a> 13 November
11221133
2000. W3C Recommendation. URL: <a
1123-
href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113">http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113</a>
1134+
href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/">http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/</a>
11241135
</dd>
11251136
<!---->
11261137

@@ -1162,6 +1173,15 @@ <h3 class=no-num id=other-references>Other references</h3>
11621173
</dd>
11631174
<!---->
11641175

1176+
<dt id=HTML5>[HTML5]
1177+
1178+
<dd>Ian Hickson. <a
1179+
href="http://www.w3.org/TR/2011/WD-html5-20110525/"><cite>HTML5.</cite></a>
1180+
25 May 2011. W3C Working Draft. (Work in progress.) URL: <a
1181+
href="http://www.w3.org/TR/2011/WD-html5-20110525/">http://www.w3.org/TR/2011/WD-html5-20110525/</a>
1182+
</dd>
1183+
<!---->
1184+
11651185
<dt id=SVG11>[SVG11]
11661186

11671187
<dd>Erik Dahlström; et al. <a
@@ -1213,6 +1233,21 @@ <h2 class=no-num id=index>Index</h2>
12131233
<li>output of the cascade, <a href="#output-of-the-cascade"
12141234
title="section 4.2."><strong>4.2.</strong></a>
12151235

1236+
<li>scoped, <a href="#scoped"
1237+
title="section 4.2."><strong>4.2.</strong></a>
1238+
1239+
<li>scoping element and that element's descendants. For example, <a
1240+
href="#HTML5" rel=biblioentry>[HTML5]<!--{{HTML5}}--></a> defines scoped
1241+
<code>&lt;style&gt;</code> elements, whose style sheets are scoped to the
1242+
element's parent. If a declaration is scoped, which element it is scoped
1243+
to affects the cascade. For the purpose of this step, declarations from
1244+
style attributes <a href="#CSSSTYLEATTR"
1245+
rel=biblioentry>[CSSSTYLEATTR]<!--{{!CSSSTYLEATTR}}--></a> are considered
1246+
to be scoped to the element with the attribute, and all unscoped
1247+
declarations are considered to be scoped to the root element., <a
1248+
href="#scoping-element-and-that-elements-descen"
1249+
title="section 4.2."><strong>4.2.</strong></a>
1250+
12161251
<li>shorthand properties, <a href="#shorthand-properties"
12171252
title="section 3."><strong>3.</strong></a>
12181253

css3-cascade/Overview.src.html

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -326,17 +326,24 @@ <h3 id='cascade'>
326326

327327
<dt id='cascade-step-scope'>Scope
328328
<dd>
329-
If a declaration belongs to a ruleset with a <a href="http://www.w3.org/TR/selectors4/#scoping">scoped selector</a>,
330-
the element it is scoped to can affect the cascade.
329+
A declaration can be <dfn>scoped</dfn> to a subtree of the document
330+
so that it only affects its <dfn>scoping element<dfn> and that element's descendants.
331+
For example, [[HTML5]] defines scoped <code>&lt;style&gt;</code> elements,
332+
whose style sheets are scoped to the element's parent.
333+
If a declaration is <i>scoped</i>,
334+
which element it is scoped to affects the cascade.
331335
For the purpose of this step,
332-
declarations from style attributes [[!CSSSTYLEATTR]] are considered to be scoped to the element with the attribute,
333-
and all other declarations are considered to be scoped to the root element.
336+
declarations from style attributes [[!CSSSTYLEATTR]]
337+
are considered to be <i>scoped</i> to the element with the attribute,
338+
and all unscoped declarations are considered to be <i>scoped</i> to the root element.
334339

335340
<p>
336-
If the <a href="http://www.w3.org/TR/selectors4/#scoping-element">scoping elements</a> of two declarations
341+
If the <i>scoping elements</i> of two declarations
337342
have an ancestor/descendant relationship,
338-
the declaration whose scoping element is the descendant wins.
339-
If one declaration is from a style attribute on an element and the other is from a ruleset scoped to that element,
343+
then for normal rules the declaration whose <i>scoping element</i> is the descendant wins,
344+
and for important rules the declaration whose <i>scoping element</i> is the ancestor wins.
345+
If one declaration is from a style attribute on an element
346+
and the other is from a ruleset otherwise <i>scoped</i> to that element,
340347
the declaration in the style attribute wins.
341348

342349
<dt id='cascade-step-specificity'>Specificity

0 commit comments

Comments
 (0)