Skip to content

Commit 32d10d2

Browse files
committed
[selectors-4] Move quirks mode statements about class and ID selectors to their respective sections. Remove normative dependency on the tree being a DOM tree: that's especially silly given we're giving guidance on mapping other types of trees/structures into the element tree used by Selectors.
1 parent a23578d commit 32d10d2

1 file changed

Lines changed: 37 additions & 29 deletions

File tree

selectors/Overview.bs

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ Selectors Overview</h2>
480480
<dt><dfn local-lt="static">static profile</dfn>
481481
<dd>
482482
The <a>static</a> profile is appropriate for contexts which aren't extremely performance sensitive;
483-
in particular, it's appropriate for contexts which evaluate selectors against a static DOM.
483+
in particular, it's appropriate for contexts which evaluate selectors against a static document tree.
484484
For example, the {{Element/query()}} method defined in [[DOM]] should use the <a>static</a> profile.
485485
It includes all of the selectors defined in this document.
486486
</dl>
@@ -570,33 +570,19 @@ Structure and Terminology</h3>
570570
<h3 id='data-model'>
571571
Data Model</h3>
572572

573-
Selectors are evaluated against a DOM tree. [[!DOM]]
573+
Selectors are evaluated against an element tree such as the DOM. [[!DOM]]
574574
Within this specification,
575575
this may be referred to as the "document tree".
576576

577-
In addition to the information present in the document tree,
578-
for the purpose of selectors,
579-
elements are assumed to have arbitrary <a>pseudo-class</a> flags
580-
and <a>pseudo-element</a> slots,
581-
as defined by the given <a>pseudo-class</a> and <a>pseudo-element</a>.
582-
583-
<div class='example'>
584-
For example, the first element child of each element
585-
has a flag indicating that it matches the '':first-child'' pseudo-class.
586-
587-
For another example,
588-
all elements have ''::before'' pseudo-elements,
589-
but not only elements with <a>shadow trees</a> have ''::shadow'' pseudo-elements.
590-
</div>
591-
592-
Five aspects of a DOM element are especially relevant for selectors:
577+
Each element may have any of the following five aspects,
578+
which can be selected against:
593579

594580
<ul>
595-
<li>The element's type (also known as tagname), which is a string.
596-
<li>The element's namespace, which is a string.
597-
<li>An ID, which is a string.
598-
<li>Classes, which are strings.
599-
<li>Attributes, which are pairs of strings consisting of an attribute name and an attribute value.
581+
<li>The element's type (also known as its tag name).
582+
<li>The element's namespace.
583+
<li>An ID.
584+
<li>Classes (named groups) to which it belongs.
585+
<li>Attributes, which are name-value pairs.
600586
</ul>
601587

602588
While individual elements may lack any of the above features,
@@ -611,10 +597,22 @@ Data Model</h3>
611597
and can't be matched by <em>any</em> <a>pseudo-class</a> except for '':host'' and '':host-context()''.)
612598
</div>
613599

614-
When matching a selector against a document which is in <a>quirks mode</a>,
615-
class and ID selectors must be matched <a lt="ASCII case-insensitive">ASCII case-insensitively</a>
616-
against the classes and ID of the elements in the document.
600+
In addition to the information present in the document tree,
601+
for the purpose of selectors,
602+
elements are assumed to have arbitrary <a>pseudo-class</a> flags
603+
and <a>pseudo-element</a> slots,
604+
as defined by the given <a>pseudo-class</a> and <a>pseudo-element</a>.
605+
606+
<div class='example'>
607+
For example, the first element child of each element
608+
has a flag indicating that it matches the '':first-child'' pseudo-class.
609+
610+
For another example,
611+
all elements have ''::before'' pseudo-elements,
612+
but not only elements with <a>shadow trees</a> have ''::shadow'' pseudo-elements.
613+
</div>
617614

615+
Issue: This section is imho unnecessary, and asserting the existence of a "first-child" flag belonging to the element is a) silly, because that information is already in the tree and b) confusing, because one could then interpret that as meaning the element keeps its first-child flag even when it is moved in the DOM.
618616

619617
<h3 id="scoping">
620618
Scoped Selectors</h3>
@@ -1614,6 +1612,10 @@ Class selectors</h3>
16141612
be reached, however, so this behavior is explicitly non-normative in
16151613
this specification.
16161614

1615+
When matching against a document which is in <a>quirks mode</a>,
1616+
class names must be matched <a lt="ASCII case-insensitive">ASCII case-insensitively</a>;
1617+
class selectors are otherwise case-sensitive.
1618+
16171619
<h3 id="id-selectors">
16181620
ID selectors</h3>
16191621

@@ -1667,6 +1669,10 @@ ID selectors</h3>
16671669
selector. Such a situation could be reached using mixtures of xml:id,
16681670
DOM3 Core, XML DTDs, and namespace-specific knowledge.
16691671

1672+
When matching against a document which is in <a>quirks mode</a>,
1673+
IDs must be matched <a lt="ASCII case-insensitive">ASCII case-insensitively</a>;
1674+
ID selectors are otherwise case-sensitive.
1675+
16701676
<h2 id="linguistic-pseudos">
16711677
Linguistic Pseudo-classes</h2>
16721678

@@ -2334,7 +2340,7 @@ Tree-Structural pseudo-classes</h2>
23342340
of children of its parent. When calculating the position of an element in
23352341
the list of children of its parent, the index numbering starts at 1.
23362342

2337-
The <a>structural pseudo-classes</a> only apply to elements in the DOM;
2343+
The <a>structural pseudo-classes</a> only apply to elements in the document tree;
23382344
they must never match <a>pseudo-elements</a>.
23392345

23402346

@@ -3354,9 +3360,11 @@ Match a Selector Against an Element</h3>
33543360
</ol>
33553361

33563362
<h2 id='dom-mapping'>
3357-
Appendix A: Guidance on Mapping Document Languages to DOM</h2>
3363+
Appendix A: Guidance on Mapping Source Documents &amp; Data to an Element Tree</h2>
3364+
3365+
<em>This section is informative.</em>
33583366

3359-
The DOM document structure is powerful and useful,
3367+
The element tree structure described by the DOM is powerful and useful,
33603368
but generic enough to model pretty much any langauge that describes tree-based data
33613369
(or even graph-based, with a suitable interpretation).
33623370

0 commit comments

Comments
 (0)