1010 rel =dcterms.rights >
1111 < meta content ="Selectors Level 4 " name =dcterms.title >
1212 < meta content =text name =dcterms.type >
13- < meta content =2013-05-01 name =dcterms.date >
13+ < meta content =2013-05-02 name =dcterms.date >
1414 < meta content ="Elika J. Etemad " name =dcterms.creator >
1515 < meta content ="Tab Atkins Jr. " name =dcterms.creator >
1616 < meta content =W3C name =dcterms.publisher >
3131
3232 < h1 id =title > Selectors Level 4</ h1 >
3333
34- < h2 class ="no-num no-toc " id =longstatus-date > Editor's Draft 1 May 2013</ h2 >
34+ < h2 class ="no-num no-toc " id =longstatus-date > Editor's Draft 2 May 2013</ h2 >
3535
3636 < dl >
3737 < dt > This version:
3838
3939 < dd > < a href ="http://dev.w3.org/csswg/selectors4/ ">
40- http://www.w3.org/TR/2013/ED-selectors4-20130501 /</ a >
40+ http://www.w3.org/TR/2013/ED-selectors4-20130502 /</ a >
4141
4242 < dt > Editor's draft:
4343
@@ -204,23 +204,26 @@ <h2 class="no-num no-toc" id=contents>Table of Contents</h2>
204204
205205 < li > < a href ="#scoping "> < span class =secno > 3.3. </ span > Scoped
206206 Selectors</ a >
207+
208+ < li > < a href ="#relative "> < span class =secno > 3.4. </ span > Relative
209+ Selectors</ a >
207210 < ul class =toc >
208- < li > < a href ="#absolutizing "> < span class =secno > 3.3 .1. </ span >
211+ < li > < a href ="#absolutizing "> < span class =secno > 3.4 .1. </ span >
209212 Absolutizing a Scope-relative Selector</ a >
210213 </ ul >
211214
212- < li > < a href ="#pseudo-classes "> < span class =secno > 3.4 . </ span >
215+ < li > < a href ="#pseudo-classes "> < span class =secno > 3.5 . </ span >
213216 Pseudo-classes</ a >
214217
215- < li > < a href ="#pseudo-elements "> < span class =secno > 3.5 .
218+ < li > < a href ="#pseudo-elements "> < span class =secno > 3.6 .
216219 </ span > Pseudo-elements</ a >
217220
218- < li > < a href ="#case-sensitive "> < span class =secno > 3.6 . </ span > Characters
221+ < li > < a href ="#case-sensitive "> < span class =secno > 3.7 . </ span > Characters
219222 and case sensitivity</ a >
220223
221- < li > < a href ="#namespaces "> < span class =secno > 3.7 . </ span > Namespaces</ a >
224+ < li > < a href ="#namespaces "> < span class =secno > 3.8 . </ span > Namespaces</ a >
222225
223- < li > < a href ="#invalid "> < span class =secno > 3.8 . </ span > Invalid Selectors
226+ < li > < a href ="#invalid "> < span class =secno > 3.9 . </ span > Invalid Selectors
224227 and Error Handling</ a >
225228 </ ul >
226229
@@ -296,7 +299,7 @@ <h2 class="no-num no-toc" id=contents>Table of Contents</h2>
296299 target pseudo-class < code > :target</ code > </ a >
297300
298301 < li > < a href ="#the-scope-pseudo "> < span class =secno > 7.5. </ span > The
299- contextual reference element pseudo-class < code > :scope</ code > </ a >
302+ reference element pseudo-class < code > :scope</ code > </ a >
300303 </ ul >
301304
302305 < li > < a href ="#useraction-pseudos "> < span class =secno > 8. </ span > User Action
@@ -825,7 +828,7 @@ <h2 id=overview><span class=secno>2. </span> Selectors Overview</h2>
825828 < tr >
826829 < td > < code > E:scope</ code >
827830
828- < td > an E element being a designated contextual reference element
831+ < td > an E element being a designated reference element
829832
830833 < td > < a href ="#scope-pseudo "> The scope pseudo-class</ a >
831834
@@ -1291,7 +1294,7 @@ <h3 id=subject><span class=secno>3.2. </span> Determining the Subject of a
12911294 Selector</ h3 >
12921295
12931296 < p > The elements of a document tree that are represented by a selector are
1294- the < dfn id =subjects > subjects</ dfn > of the selector.
1297+ the < dfn id =subjects title = subject > subjects</ dfn > of the selector.
12951298
12961299 < p > By default, the subjects of a selector are the elements represented by
12971300 the last < a href ="#compound "> < i > compound selector</ i > </ a > in the selector.
@@ -1331,76 +1334,82 @@ <h3 id=subject><span class=secno>3.2. </span> Determining the Subject of a
13311334
13321335 < h3 id =scoping > < span class =secno > 3.3. </ span > Scoped Selectors</ h3 >
13331336
1334- < p > Some host applications may choose to < dfn id =scope > scope </ dfn > selectors
1335- to a particular subtree of the document. The root of the scoping subtree
1336- is called the < dfn id = scoping-element > scoping element </ dfn > , and is
1337- in-scope. When scoped selectors are used, it forms the < a
1338- href =" #contextual-reference- element-set " > < i > contextual reference element
1339- set </ i > </ a > and matches the < a
1340- href =" #scope-pseudo " > < code > :scope </ code > </ a > pseudo-class .
1337+ < p > Some host applications may choose to < dfn id =scope
1338+ title =" scope | scoped selector " > scope </ dfn > selectors to a particular
1339+ subtree or fragment of the document. The root of the scoping subtree is
1340+ called the < dfn id = scoping-root > scoping root </ dfn > , and may be either a
1341+ true element (the < dfn id = scoping- element> scoping element </ dfn > ) or a < dfn
1342+ id = virtual title =" virtual scoping root " > virtual </ dfn > one (such as a
1343+ < code > DocumentFragment </ code > ) .
13411344
1342- < p > There are three methods of scoping selectors:
1345+ < p > There are two methods of scoping selectors:
13431346
13441347 < dl >
13451348 < dt > < dfn id =scope-contained-selectors
13461349 title ="scope-contained | scope-contained selector "> scope-contained
13471350 selectors</ dfn >
13481351
13491352 < dd > With this method of scoping, selectors match as if the < a
1350- href ="#scoping-element "> < i > scoping element </ i > </ a > were the root of the
1351- document: all < a href ="#compound "> < i > compound selectors</ i > </ a > must
1352- match elements within the scope. (The < a
1353+ href ="#scoping-root "> < i > scoping root </ i > </ a > were the root of the
1354+ document: all < a href ="#compound "> < i > compound selectors</ i > </ a > must be
1355+ represented within the scope. (The < a
13531356 href ="#roo-pseudo "> < code > :root</ code > </ a > pseudo-class, however, still
13541357 only matches the actual root of the document.)
13551358
13561359 < dt > < dfn id =scope-filtered
13571360 title ="scope-filtered | scope-filtered selector "> scope-filtered</ dfn >
13581361 selectors
13591362
1360- < dd > With this method of scoping, a selector matches if the < i > subject</ i >
1361- of the selector is within the scope, even if other components of the
1362- selector are outside the scope.
1363-
1364- < dt > < dfn id =scope-relative
1365- title ="scope-relative | scope-relative selector "> scope-relative</ dfn >
1366- selectors
1367-
1368- < dd > With this method of scoping, "< a
1369- href ="#scope-pseudo "> < code > :scope</ code > </ a > " (the < a
1370- href ="#scope-pseudo "> < code > :scope</ code > </ a > pseudo-class followed by a
1371- space) is implied at the beginning of each < a href ="#complex "> < i > complex
1372- selector</ i > </ a > that does not already contain the < a
1373- href ="#scope-pseudo "> < code > :scope</ code > </ a > pseudo-class. This allows
1374- the selector to begin syntactically with a < a
1375- href ="#combinator "> < i > combinator</ i > </ a > . The scoping element matches
1376- this implied < a href ="#scope-pseudo "> < code > :scope</ code > </ a > selector,
1377- but does not limit which elements match.
1378- < p > Scope-relative selectors must be < a
1379- href ="#absolutize "> absolutized</ a > before using them for matching.
1380-
1381- < p class =issue > It might be necessary (for, e.g.
1382- < code > ::distributed()</ code > or < code > documentFragment.find()</ code > ),
1383- to split the concept of scope-relative selector into multiple concepts.
1363+ < dd > With this method of scoping, a selector matches if the < a
1364+ href ="#subjects "> < i > subject</ i > </ a > of the selector is within the scope,
1365+ even if other components of the selector are outside the scope. (A < a
1366+ href ="#scoping-element "> < i > scoping element</ i > </ a > is considered to be in
1367+ scope.)
13841368 </ dl >
13851369
13861370 < div class =example >
13871371 < p > For example, the < code > element.querySelector()</ code > function defined
13881372 in < a href ="#SELECTORS-API2 "
13891373 rel =biblioentry > [SELECTORS-API2]<!--{{SELECTORS-API2}}--> </ a > allows the
13901374 author to define a < a href ="#scope-filtered "> < i > scope-filtered</ i > </ a >
1391- selector, while the similar < code > element.find</ code > function defined in
1392- the same spec uses < a href ="#scope-relative "> < i > scope-relative</ i > </ a >
1393- selectors.
1375+ selector.
13941376
13951377 < p > On the other hand, the selectors within an < a href ="#HTML5 "
13961378 rel =biblioentry > [HTML5]<!--{{HTML5}}--> </ a > scoped stylesheet define < a
13971379 href ="#scope-contained-selectors "> < i > scope-contained</ i > </ a > selectors.
13981380 </ div >
13991381
1400- < h4 id =absolutizing > < span class =secno > 3.3.1. </ span > Absolutizing a
1382+ < p > Unless otherwise specified, the < a href ="#scoping-root "> < i > scoping
1383+ root</ i > </ a > also forms the < a href ="#reference-element-set "> < i > reference
1384+ element set</ i > </ a > and matches the < a
1385+ href ="#scope-pseudo "> < code > :scope</ code > </ a > pseudo-class.
1386+
1387+ < h3 id =relative > < span class =secno > 3.4. </ span > Relative Selectors</ h3 >
1388+
1389+ < p > Certain contexts may accept < dfn id =relative-selectors
1390+ title ="relative selector | relative | scope-relative "> relative
1391+ selectors</ dfn > , which are a shorthand for selectors that represent
1392+ elements relative to a < i > reference element</ i > (i.e. an element that
1393+ matches < a href ="#scope-pseudo "> < code > :scope</ code > </ a > ). In a < a
1394+ href ="#relative-selectors "> < i > relative selector</ i > </ a > , “< a
1395+ href ="#scope-pseudo "> < code > :scope</ code > </ a > ” (the < a
1396+ href ="#scope-pseudo "> < code > :scope</ code > </ a > pseudo-class followed by a
1397+ space) is implied at the beginning of each < a href ="#complex "> < i > complex
1398+ selector</ i > </ a > that does not already contain the < a
1399+ href ="#scope-pseudo "> < code > :scope</ code > </ a > pseudo-class. This allows the
1400+ selector to begin syntactically with a < a
1401+ href ="#combinator "> < i > combinator</ i > </ a > . However, it must be < a
1402+ href ="#absolutize "> absolutized</ a > before matching.
1403+
1404+ < p > Relative selectors, once absolutized, can additionally be < a
1405+ href ="#scope-contained-selectors "> < i > scope-contained</ i > </ a > (such as
1406+ within the < code > ::distributed()</ code > pseudo-class [[SHADOWDOM]]) or < a
1407+ href ="#scope-filtered "> < i > scope-filtered</ i > </ a > .
1408+
1409+ < h4 id =absolutizing > < span class =secno > 3.4.1. </ span > Absolutizing a
14011410 Scope-relative Selector</ h4 >
14021411
1403- < p > To < dfn id =absolutize > absolutize a scope- relative selector</ dfn > :
1412+ < p > To < dfn id =absolutize > absolutize a relative selector</ dfn > :
14041413
14051414 < ol >
14061415 < li > If the selector starts with a < a
@@ -1409,9 +1418,8 @@ <h4 id=absolutizing><span class=secno>3.3.1. </span> Absolutizing a
14091418 < a href ="#scope-pseudo "> < code > :scope</ code > </ a > as the initial < a
14101419 href ="#compound "> < i > compound selector</ i > </ a > .
14111420
1412- < li > Otherwise, if the < a
1413- href ="#contextual-reference-element-set "> < i > contextual reference element
1414- set</ i > </ a > is empty, the selector is already absolute.
1421+ < li > Otherwise, if the < a href ="#reference-element-set "> < i > reference
1422+ element set</ i > </ a > is empty, the selector is already absolute.
14151423
14161424 < li > Otherwise, if the selector does not contain any instance of the < a
14171425 href ="#scope-pseudo "> < code > :scope</ code > </ a > pseudo-class (either at the
@@ -1422,10 +1430,10 @@ <h4 id=absolutizing><span class=secno>3.3.1. </span> Absolutizing a
14221430 < li > Otherwise, the selector is already absolute.
14231431 </ ol >
14241432
1425- < p > To < dfn id =absolutize-list > absolutize a scope- relative selector
1426- list </ dfn > , absolutize each scope- relative selector in the list.
1433+ < p > To < dfn id =absolutize-list > absolutize a relative selector list </ dfn > ,
1434+ absolutize each relative selector in the list.
14271435
1428- < h3 id =pseudo-classes > < span class =secno > 3.4 . </ span > Pseudo-classes</ h3 >
1436+ < h3 id =pseudo-classes > < span class =secno > 3.5 . </ span > Pseudo-classes</ h3 >
14291437
14301438 < p > The < dfn id =pseudo-class > pseudo-class</ dfn > concept is introduced to
14311439 permit selection based on information that lies outside of the document
@@ -1463,7 +1471,7 @@ <h3 id=pseudo-classes><span class=secno>3.4. </span> Pseudo-classes</h3>
14631471 tree. They do not appear in or modify the document source or document
14641472 tree.
14651473
1466- < h3 id =pseudo-elements > < span class =secno > 3.5 . </ span > Pseudo-elements</ h3 >
1474+ < h3 id =pseudo-elements > < span class =secno > 3.6 . </ span > Pseudo-elements</ h3 >
14671475
14681476 < p > < dfn id =pseudo-element title =pseudo-element > Pseudo-elements</ dfn > create
14691477 abstractions about the document tree beyond those specified by the
@@ -1547,7 +1555,7 @@ <h3 id=pseudo-elements><span class=secno>3.5. </span>Pseudo-elements</h3>
15471555 defines the ::before, ::after, ::first-line and ::first-letter
15481556 pseudo-elements.
15491557
1550- < h3 id =case-sensitive > < span class =secno > 3.6 . </ span > Characters and case
1558+ < h3 id =case-sensitive > < span class =secno > 3.7 . </ span > Characters and case
15511559 sensitivity</ h3 >
15521560
15531561 < p > All Selectors syntax is case-insensitive within the ASCII range (i.e.
@@ -1578,7 +1586,7 @@ <h3 id=case-sensitive><span class=secno>3.6. </span> Characters and case
15781586 combinator, but ‘< code class =css > #foo\> a</ code > ’ instead selects an
15791587 element with the id < code > foo> a</ code > .
15801588
1581- < h3 id =namespaces > < span class =secno > 3.7 . </ span > Namespaces</ h3 >
1589+ < h3 id =namespaces > < span class =secno > 3.8 . </ span > Namespaces</ h3 >
15821590
15831591 < p > Certain selectors support namespace prefixes. The mechanism by which
15841592 namespace prefixes are < dfn id =nsdecl > declared</ dfn > should be specified
@@ -1589,7 +1597,7 @@ <h3 id=namespaces><span class=secno>3.7. </span> Namespaces</h3>
15891597 rule. < a href ="#CSS3NAMESPACE "
15901598 rel =biblioentry > [CSS3NAMESPACE]<!--{{!CSS3NAMESPACE}}--> </ a >
15911599
1592- < h3 id =invalid > < span class =secno > 3.8 . </ span > Invalid Selectors and Error
1600+ < h3 id =invalid > < span class =secno > 3.9 . </ span > Invalid Selectors and Error
15931601 Handling</ h3 >
15941602
15951603 < p > User agents must observe the rules for handling < dfn
@@ -2578,30 +2586,35 @@ <h3 id=the-target-pseudo><span class=secno>7.4. </span> The target
25782586 --> *:target::before { content : url(target.png) }</ pre >
25792587 </ div >
25802588
2581- < h3 id =the-scope-pseudo > < span class =secno > 7.5. </ span > The contextual
2582- reference element pseudo-class < a
2583- href ="#scope-pseudo "> < code > :scope</ code > </ a > </ h3 >
2589+ < h3 id =the-scope-pseudo > < span class =secno > 7.5. </ span > The reference
2590+ element pseudo-class < a href ="#scope-pseudo "> < code > :scope</ code > </ a > </ h3 >
25842591
25852592 < p > The < dfn id =scope-pseudo > :scope</ dfn > pseudo-class represents any
2586- element that is in the < dfn id =contextual- reference-element-set> contextual
2587- reference element set</ dfn > . This is is a (potentially empty)
2588- explicitly-specified set of elements , such as that specified by the
2589- < code > querySelector()</ code > call in < a href ="#SELECTORS-API2 "
2593+ element that is in the < dfn id =reference-element-set > reference element
2594+ set</ dfn > . This is is a (potentially empty) set of elements that provide a
2595+ reference point for selectors to match against , such as that specified by
2596+ the < code > querySelector()</ code > call in < a href ="#SELECTORS-API2 "
25902597 rel =biblioentry > [SELECTORS-API2]<!--{{SELECTORS-API2}}--> </ a > , or the
25912598 parent element of a < a
25922599 href ="http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-style-element "> scoped
25932600 < code > <style> </ code > element</ a > in < a href ="#HTML5 "
2594- rel =biblioentry > [HTML5]<!--{{HTML5}}--> </ a > , which is used to "scope" a
2595- selector so that it only matches within a subtree.
2601+ rel =biblioentry > [HTML5]<!--{{HTML5}}--> </ a > .
25962602
2597- < p > If no contextual reference element set is given, < a
2598- href ="#scope-pseudo "> < code > :scope</ code > </ a > is equivalent to < a
2599- href ="#roo-pseudo "> < code > :root</ code > </ a > . Specifications intending for
2603+ < p > If the < a href ="#reference-element-set "> < i > reference element
2604+ set</ i > </ a > is not explicitly specified, it defaults to representing the
2605+ < a href ="#scoping-root "> < i > scoping root</ i > </ a > (if any), else represents
2606+ the root of the docoment (i.e. matches < a
2607+ href ="#roo-pseudo "> < code > :root</ code > </ a > ). Specifications intending for
26002608 this pseudo-class to match specific elements rather than the document's
2601- root element must define a < a
2602- href ="#contextual-reference-element-set "> < i > contextual reference element
2609+ root element must define either a < a href ="#scoping-root "> < i > scoping
2610+ root</ i > </ a > (if using < a href ="#scope "> < i > scoped selectors</ i > </ a > ) or an
2611+ explicit < a href ="#reference-element-set "> < i > reference element
26032612 set</ i > </ a > .
26042613
2614+ < p class =note > Note that since this pseudo-class only represents elements,
2615+ a virtual < a href ="#scoping-root "> < i > scoping root</ i > </ a > cannot be the
2616+ subject of a selector; such a selector effectively represents nothing.
2617+
26052618 < h2 id =useraction-pseudos > < span class =secno > 8. </ span > User Action
26062619 Pseudo-classes</ h2 >
26072620
@@ -4242,7 +4255,7 @@ <h2 id=grammar><span class=secno>16. </span><a id=formal-syntax></a>
42424255
42434256 < dd > A < code > scope_relative_selector_list</ code > production representing a
42444257 < a href ="#selector-list "> < i > selector list</ i > </ a > comprised of < a
4245- href ="#scope- relative "> < i > scope- relative selectors</ i > </ a > .
4258+ href ="#relative-selectors "> < i > relative selectors</ i > </ a > .
42464259
42474260 < dt > < dfn id =ltcompound-selector > < var > <compound-selector> </ var > </ dfn >
42484261
@@ -4259,36 +4272,13 @@ <h2 id=grammar><span class=secno>16. </span><a id=formal-syntax></a>
42594272 < h2 id =changes > < span class =secno > 17. </ span > Changes</ h2 >
42604273
42614274 < p > Significant changes since the < a
4262- href ="http://www.w3.org/TR/2012 /WD-selectors4-20120823 / "> 23 August 2012
4275+ href ="http://www.w3.org/TR/2013 /WD-selectors4-20130502 / "> 2 MaY 2013
42634276 Working Draft</ a > include:
42644277
42654278 < ul >
4266- < li > Added < a href ="#blank-pseudo "> < code > :blank</ code > </ a > and < a
4267- href ="#placeholder-shown-pseudo "> < code > :placeholder-shown</ code > </ a >
4268- pseudo-classes.
4269-
4270- < li > Released some restrictions on < a
4271- href ="#matches-pseudo "> < code > :matches()</ code > </ a > and < a
4272- href ="#negation-pseudo "> < code > :not()</ code > </ a > .
4273-
4274- < li > Defined < a href ="#fast-profile "> < i > fast</ i > </ a > and < a
4275- href ="#complete-profile "> < i > complete</ i > </ a > Selectors profiles.
4276-
4277- < li > Improved definition of < a href ="#specificity "> specificity</ a > to
4278- better handle < a href ="#matches-pseudo "> < code > :matches()</ code > </ a > .
4279-
4280- < li > Updated grammar.
4281-
4282- < li > Cleaned up definition of < a href ="#anb0 "> < var > An+B</ var > </ a > notation.
4283-
4284- < li > Added definition of < a
4285- href ="#scope-relative "> < i > scope-relative</ i > </ a > selectors, changed
4286- < i > scope-constrained</ i > to < a
4287- href ="#scope-filtered "> < i > scope-filtered</ i > </ a > for less confusion with
4288- < a href ="#scope-contained-selectors "> < i > scope-contained</ i > </ a > .
4289-
4290- < li > The < code > :local-link()</ code > pseudo-class now ignores trailing
4291- slashes.
4279+ < li > Split out < a href ="#relative-selectors "> < i > relative selectors</ i > </ a >
4280+ from < a href ="#scope "> < i > scoped selectors</ i > </ a > , as these are different
4281+ concepts that can be independently invoked.
42924282 </ ul >
42934283
42944284 < h2 id =conformance > < span class =secno > 18. </ span > Conformance</ h2 >
0 commit comments