Skip to content

Commit 29daa54

Browse files
committed
Add section for scoped selectors.
1 parent 9917802 commit 29daa54

2 files changed

Lines changed: 81 additions & 21 deletions

File tree

selectors4/Overview.html

Lines changed: 56 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919

2020
<h1 id=title>Selectors Level 4</h1>
2121

22-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 22 June 2012</h2>
22+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 9 August 2012</h2>
2323

2424
<dl>
2525
<dt>This version: <!--
26-
<dd><a href="http://www.w3.org/TR/2012/ED-selectors4-20120622/">
27-
http://www.w3.org/TR/2012/WD-selectors4-20120622/</a>
26+
<dd><a href="http://www.w3.org/TR/2012/ED-selectors4-20120809/">
27+
http://www.w3.org/TR/2012/WD-selectors4-20120809/</a>
2828
2929
<dt>Editor's draft:
3030
-->
@@ -167,18 +167,21 @@ <h2 class="no-num no-toc" id=contents>Table of Contents</h2>
167167
<li><a href="#subject"><span class=secno>3.2. </span> Determining the
168168
Subject of a Selector</a>
169169

170-
<li><a href="#pseudo-classes"><span class=secno>3.3. </span>
170+
<li><a href="#scoping"><span class=secno>3.3. </span> Scoped
171+
Selectors</a>
172+
173+
<li><a href="#pseudo-classes"><span class=secno>3.4. </span>
171174
Pseudo-classes</a>
172175

173-
<li><a href="#pseudo-elements"><span class=secno>3.4.
176+
<li><a href="#pseudo-elements"><span class=secno>3.5.
174177
</span>Pseudo-elements</a>
175178

176-
<li><a href="#case-sensitive"><span class=secno>3.5. </span> Characters
179+
<li><a href="#case-sensitive"><span class=secno>3.6. </span> Characters
177180
and case sensitivity</a>
178181

179-
<li><a href="#namespaces"><span class=secno>3.6. </span> Namespaces</a>
182+
<li><a href="#namespaces"><span class=secno>3.7. </span> Namespaces</a>
180183

181-
<li><a href="#invalid"><span class=secno>3.7. </span> Invalid Selectors
184+
<li><a href="#invalid"><span class=secno>3.8. </span> Invalid Selectors
182185
and Error Handling</a>
183186
</ul>
184187

@@ -1196,7 +1199,36 @@ <h3 id=subject><span class=secno>3.2. </span> Determining the Subject of a
11961199
but the subjects of the selectors are not.
11971200
</div>
11981201

1199-
<h3 id=pseudo-classes><span class=secno>3.3. </span> Pseudo-classes</h3>
1202+
<h3 id=scoping><span class=secno>3.3. </span> Scoped Selectors</h3>
1203+
1204+
<p>Some host applications may choose to <dfn id=scope>scope</dfn> selectors
1205+
to a particular subtree of the document. There are two methods of doing
1206+
this:
1207+
1208+
<dl>
1209+
<dt><dfn id=scope-contained>scope-contained</dfn> selectors
1210+
1211+
<dd> With this method of scoping, selectors match as if the <a
1212+
href="#scoping-element"><i>scoping element</i></a> were the root of the
1213+
document: all <a href="#compound"><i>compound selectors</i></a> must
1214+
match elements within the scope. (The <code>:root</code> pseudo-class,
1215+
however, still only matches the actual root of the document.)
1216+
1217+
<dt><dfn id=scope-constrained>scope-constrained</dfn> selectors
1218+
1219+
<dd> With this method of scoping, a selector matches if the <i>subject</i>
1220+
of the selector is within the scope, even if other components of the
1221+
selector are outside the scope.
1222+
</dl>
1223+
1224+
<p>The root of the scoping subtree is called the <dfn
1225+
id=scoping-element>scoping element</dfn> and is in-scope. When scoped
1226+
selectors are used, it forms the <a
1227+
href="#contextual-reference-element-set"><i>contextual reference element
1228+
set</i></a> and can be selected with the <a
1229+
href="#scope"><code>:scope</code></a> pseudo-class.
1230+
1231+
<h3 id=pseudo-classes><span class=secno>3.4. </span> Pseudo-classes</h3>
12001232

12011233
<p>The pseudo-class concept is introduced to permit selection based on
12021234
information that lies outside of the document tree or that cannot be
@@ -1225,7 +1257,7 @@ <h3 id=pseudo-classes><span class=secno>3.3. </span> Pseudo-classes</h3>
12251257
<p>Dynamic pseudo-classes do not appear in the document source or document
12261258
tree.
12271259

1228-
<h3 id=pseudo-elements><span class=secno>3.4. </span>Pseudo-elements</h3>
1260+
<h3 id=pseudo-elements><span class=secno>3.5. </span>Pseudo-elements</h3>
12291261

12301262
<p>Pseudo-elements create abstractions about the document tree beyond those
12311263
specified by the document language. For instance, document languages do
@@ -1272,7 +1304,7 @@ <h3 id=pseudo-elements><span class=secno>3.4. </span>Pseudo-elements</h3>
12721304
<code>::first-line:focus</code> will never match anything.
12731305
</div>
12741306

1275-
<h3 id=case-sensitive><span class=secno>3.5. </span> Characters and case
1307+
<h3 id=case-sensitive><span class=secno>3.6. </span> Characters and case
12761308
sensitivity</h3>
12771309

12781310
<p>All Selectors syntax is case-insensitive within the ASCII range (i.e.
@@ -1295,7 +1327,7 @@ <h3 id=case-sensitive><span class=secno>3.5. </span> Characters and case
12951327
rules</a> as CSS. <a href="#CSS21"
12961328
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>.
12971329

1298-
<h3 id=namespaces><span class=secno>3.6. </span> Namespaces</h3>
1330+
<h3 id=namespaces><span class=secno>3.7. </span> Namespaces</h3>
12991331

13001332
<p>Certain selectors support namespace prefixes. The mechanism by which
13011333
namespace prefixes are <dfn id=nsdecl>declared</dfn> should be specified
@@ -1306,7 +1338,7 @@ <h3 id=namespaces><span class=secno>3.6. </span> Namespaces</h3>
13061338
rule. <a href="#CSS3NAMESPACE"
13071339
rel=biblioentry>[CSS3NAMESPACE]<!--{{!CSS3NAMESPACE}}--></a>
13081340

1309-
<h3 id=invalid><span class=secno>3.7. </span> Invalid Selectors and Error
1341+
<h3 id=invalid><span class=secno>3.8. </span> Invalid Selectors and Error
13101342
Handling</h3>
13111343

13121344
<p>Invalidity is caused by a parsing error, e.g. an unrecognized token or a
@@ -2217,15 +2249,18 @@ <h3 id=target-pseudo><span class=secno>7.4. </span> The target pseudo-class
22172249
</div>
22182250

22192251
<h3 id=scope-pseudo><span class=secno>7.5. </span> The contextual reference
2220-
element pseudo-class ‘<code class=css>:scope</code></h3>
2252+
element pseudo-class ‘<a href="#scope"><code
2253+
class=css>:scope</code></a></h3>
22212254

22222255
<p class=issue>Should this be renamed to <code>:context</code>, since it's
22232256
referencing a <em>context</em>ual reference element?
22242257

2225-
<p>The <code>:scope</code> pseudo-class represents any element that is in
2226-
the <a href="#contextual-reference-element-set"><i>contextual reference
2227-
element set</i></a>. If no contextual reference element set is given,
2228-
<code>:scope</code> is equivalent to <code>:root</code>.
2258+
<p>The <a href="#scope"><code>:scope</code></a> pseudo-class represents any
2259+
element that is in the <a
2260+
href="#contextual-reference-element-set"><i>contextual reference element
2261+
set</i></a>. If no contextual reference element set is given, <a
2262+
href="#scope"><code>:scope</code></a> is equivalent to <code>:root</code>.
2263+
22292264

22302265
<p>The <dfn id=contextual-reference-element-set>contextual reference
22312266
element set</dfn> is a (potentially empty) explicitly-specified set of
@@ -3941,10 +3976,10 @@ <h3 id=informative-references><span class=secno>20.2. </span> Informative
39413976
<dt id=SELECTORS-API2>[SELECTORS-API2]
39423977

39433978
<dd>Lachlan Hunt. <a
3944-
href="http://www.w3.org/TR/2010/WD-selectors-api2-20100119/"><cite>Selectors
3945-
API Level 2.</cite></a> 19 January 2010. W3C Working Draft. (Work in
3979+
href="http://www.w3.org/TR/2012/WD-selectors-api2-20120628/"><cite>Selectors
3980+
API Level 2.</cite></a> 28 June 2012. W3C Working Draft. (Work in
39463981
progress.) URL: <a
3947-
href="http://www.w3.org/TR/2010/WD-selectors-api2-20100119/">http://www.w3.org/TR/2010/WD-selectors-api2-20100119/</a>
3982+
href="http://www.w3.org/TR/2012/WD-selectors-api2-20120628/">http://www.w3.org/TR/2012/WD-selectors-api2-20120628/</a>
39483983
</dd>
39493984
<!---->
39503985

selectors4/Overview.src.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,31 @@ <h3 id=subject>
574574
but the subjects of the selectors are not.
575575
</div>
576576

577+
<h3 id=scoping>
578+
Scoped Selectors</h3>
579+
580+
<p>Some host applications may choose to <dfn>scope</dfn> selectors
581+
to a particular subtree of the document.
582+
There are two methods of doing this:
583+
<dl>
584+
<dt><dfn>scope-contained</dfn> selectors
585+
<dd>
586+
With this method of scoping, selectors match as if
587+
the <i>scoping element</i> were the root of the document:
588+
all <i>compound selectors</i> must match elements within the scope.
589+
(The <code>:root</code> pseudo-class, however,
590+
still only matches the actual root of the document.)
591+
<dt><dfn>scope-constrained</dfn> selectors
592+
<dd>
593+
With this method of scoping, a selector matches if
594+
the <i>subject</i> of the selector is within the scope,
595+
even if other components of the selector are outside the scope.
596+
</dl>
597+
<p>The root of the scoping subtree is called the <dfn>scoping element</dfn>
598+
and is in-scope.
599+
When scoped selectors are used, it forms the <i>contextual reference element set</i>
600+
and can be selected with the <code>:scope</code> pseudo-class.
601+
577602
<h3 id=pseudo-classes>
578603
Pseudo-classes</h3>
579604

0 commit comments

Comments
 (0)