8000 More minor reshuffling. Add subject indicator per Daniel's old old ol… · w3c/csswg-drafts@ed46ec2 · GitHub
Skip to content

Commit ed46ec2

Browse files
committed
More minor reshuffling. Add subject indicator per Daniel's old old old proposal.
1 parent f922229 commit ed46ec2

1 file changed

Lines changed: 52 additions & 22 deletions

File tree

selectors4/Overview.src.html

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -413,50 +413,74 @@ <h2 id=overview>
413413
prepending "matches" to the contents of each cell in the "Meaning"
414414
column.</p>
415415

416-
<h2 id=structure>
417-
Selector Syntax and Structure</h2>
416+
<h2 id=syntax>
417+
Selector Syntax</h2>
418+
419+
<h3 id=structure>
420+
Structure and Terminology</h2>
418421

419422
<p>A <dfn>selector</dfn> is a chain of one
420423
or more <a href="#compound">compound selectors</a>
421424
separated by <a href="#combinators">combinators</a>.</p>
422425

423426
<p>A <dfn><a name=compound>compound selector</a></dfn>
424-
is a chain of <a href="#simple-selectors-dfn">simple selectors</a>
427+
is a chain of <a href="#simple">simple selectors</a>
425428
that are not separated by a <a href="#combinators">combinator</a>. It
426429
always begins with a <a href="#type-selectors">type selector</a> or a
427-
<a href="#universal-selector">universal selector</a>. No other type
428-
selector or universal selector is allowed in the sequence.</p>
430+
(possibly implied) <a href="#universal-selector">universal selector</a>.
431+
No other type selector or universal selector is allowed in the sequence.</p>
429432

430433
<p>A <dfn><a name=simple-selectors-dfn></a><a
431-
href="#simple-selectors">simple selector</a></dfn> is either a <a
434+
href="#simple">simple selector</a></dfn> is either a <a
432435
href="#type-selectors">type selector</a>, <a
433436
href="#universal-selector">universal selector</a>, <a
434437
href="#attribute-selectors">attribute selector</a>, <a
435438
href="#class-html">class selector</a>, <a
436439
href="#id-selectors">ID selector</a>, or <a
437440
href="#pseudo-classes">pseudo-class</a>.</p>
438441

439-
<p><dfn>Combinators</dfn> are: whitespace, &quot;greater-than
442+
<p><dfn>Combinators</dfn> are punctuation that represent a particular
443+
kind of relationship between the compound selectors on either side.
444+
Combinators in Selectors level 4 include: whitespace, &quot;greater-than
440445
sign&quot; (U+003E, <code>&gt;</code>), &quot;plus sign&quot; (U+002B,
441-
<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>). White
442-
space may appear between a combinator and the simple selectors around
443-
it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab"
444-
(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form
445-
feed" (U+000C) can occur in whitespace. Other space-like characters,
446-
such as "em-space" (U+2003) and "ideographic space" (U+3000), are
447-
never part of whitespace.</p>
448-
449-
<p>The elements of a document tree that are represented by a selector
450-
are the <dfn><a name=subject></a>subjects of the selector</dfn>. A
451-
selector consisting of a single compound selector
452-
represents any element satisfying its requirements. Prepending another
453-
compound selector and a combinator to a sequence imposes
454-
additional matching constraints, so the subjects of a selector are
455-
always a subset of the elements represented by the last compound selector.</p>
446+
<code>+</code>) and &quot;tilde&quot; (U+007E, <code>~</code>).
447+
<a href="#whitespace">White space</a> may appear between a combinator
448+
and the simple selectors around it.</p>
456449

457450
<p>An empty selector, containing no compound selector, is an
458451
<a href="#invalid">invalid selector</a>.</p>
459452

453+
<h3 id=subject>
454+
Subject of a Selector
455+
456+
<p>The elements of a document tree that are represented by a selector
457+
are the <dfn>subjects</dfn> of the selector.
458+
459+
<p>By default, the subjects of a selector are the elements represented
460+
by the last compound selector in the selector. Thus a selector consisting
461+
of a single compound selector represents any element satisfying its
462+
requirements. Prepending another compound selector and a combinator
463+
to a sequence imposes additional matching constraints, so the subjects of
464+
the selector are always a subset of the elements represented by the last
465+
compound selector.</p>
466+
467+
<p>The subject of the selector can be explicitly identified by prepending
468+
an exclamation mark (!) to one of the compound selectors in a selector.
469+
Although the element structure that the selector represents is the same
470+
with or without the exclamation mark, indicating the subject in this way
471+
can change which compound selector represents the subject in that structure.
472+
473+
<div class="example">
474+
<p>For example, the following selector represents a list item <code>LI</code>
475+
unique child of an ordered list <code>OL</code>:
476+
<pre>OL &gt; LI:only-child</pre>
477+
<p>However the following one represents an ordered list <code>OL</code>
478+
having a unique child, that child being a <code>LI</code>:
479+
<pre>!OL &gt; LI:only-child</pre>
480+
<p>The structures represented by these two selectors are the same, but the
481+
subjects of the selectors are not.
482+
</div>
483+
460484
<h3 id=case-sensitive>
461485
Characters and case sensitivity</h3>
462486

@@ -469,6 +493,12 @@ <h3 id=case-sensitive>
469493
case-sensitive. Case sensitivity of namespace prefixes is defined in
470494
[[!CSS3NAMESPACE]].</p>
471495

496+
<p><dfn id=whitespace>White space</dfn> in Selectors consists of the
497+
characters SPACE (U+0020), TAB (U+0009), LINE FEED (U+000A),
498+
CARRIAGE RETURN (U+000D), and FORM FEED (U+000C) can occur in whitespace.
499+
Other space-like characters, such as EM SPACE (U+2003) and
500+
IDEOGRAPHIC SPACE (U+3000), are never part of white space.
501+
472502
<p>Characters in Selectors can be escaped with a backslash according
473503
to the same <a href="http://www.w3.org/TR/CSS21/syndata.html#characters">escaping
474504
rules</a> as CSS. [[!CSS21]].</p>

0 commit comments

Comments
 (0)