Skip to content

Commit 969aa5a

Browse files
committed
[selectors] Add >> form of descendant combinator per WG resolution <http://lists.w3.org/Archives/Public/www-style/2014Jun/0106.html>
--HG-- extra : rebase_source : f4471dd2ce2e6741dabe39ba54d3e72a63cf9f91
1 parent 8b46c2a commit 969aa5a

2 files changed

Lines changed: 4307 additions & 1931 deletions

File tree

selectors/Overview.bs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,10 @@ Selectors Overview</h2>
413413
<td>3
414414
<tbody>
415415
<tr>
416-
<td><code>E F</code>
416+
<td><code>E F</code> <em>or</em> <code>E >> F</code>
417417
<td>an F element descendant of an E element
418418
<td>[[#descendant-combinators]]
419-
<td>1
419+
<td>1 <em>or</em> 4
420420
<tr>
421421
<td><code>E > F</code>
422422
<td>an F element child of an E element
@@ -886,7 +886,7 @@ Absolutizing a Relative Selector</h4>
886886
only matches elements without a parent.
887887

888888
<li>
889-
Otherwise, if the selector starts with any combinator other than the <a>descendant combinator</a>,
889+
Otherwise, if the selector starts with any combinator other than the white space form of the <a>descendant combinator</a>,
890890
change the selector to '':not(*)''.
891891
<span class='note'>This is the shortest selector that is valid, but guaranteed to match nothing.</span>
892892

@@ -898,13 +898,13 @@ Absolutizing a Relative Selector</h4>
898898

899899
<ol>
900900
<li>
901-
If the selector starts with a <a>combinator</a> other than the <a>descendant combinator</a>,
901+
If the selector starts with a <a>combinator</a> other than the white space form of the <a>descendant combinator</a>,
902902
prepend '':scope'' as the initial <a>compound selector</a>.
903903

904904
<li>
905905
Otherwise, if the selector does not contain any instance of the '':scope'' pseudo-class
906906
(either at the top-level or as an argument to a functional pseudo-class),
907-
prepend '':scope'' followed by the <a>descendant combinator</a>.
907+
prepend '':scope'' followed by the white space form of the <a>descendant combinator</a>.
908908

909909
<li>
910910
Otherwise, the selector is already absolute.
@@ -2893,15 +2893,19 @@ Typed Child-indexed Pseudo-classes</h3>
28932893
Combinators</h2>
28942894

28952895
<h3 id="descendant-combinators">
2896-
Descendant combinator (<code> </code>)</h3>
2896+
Descendant combinator (<code> </code>) <em>or</em> (<code>>></code>)</h3>
28972897

28982898
At times, authors may want selectors to describe an element that is
28992899
the descendant of another element in the document tree (e.g., "an
29002900
<a element>em</a> element that is contained within an <a element>H1</a> element").
2901-
Descendant combinators express such a relationship. A
2902-
<dfn export>descendant combinator</dfn> is <a href="#whitespace">whitespace</a> that
2903-
separates two <a>compound selectors</a>. A selector of the form
2904-
''A B'' represents an element <code>B</code> that is an
2901+
The <dfn export>descendant combinator</dfn> expresses such a relationship.
2902+
It has two syntactic forms:
2903+
<ol>
2904+
<li><a href="#whitespace">whitespace</a> that separates two <a>compound selectors</a> <em>or</em>
2905+
<li>A doubled child selector (<code>>></code>)
2906+
</ol>
2907+
2908+
A selector of the form ''A B'' or ''A >> B''' represents an element <code>B</code> that is an
29052909
arbitrary descendant of some ancestor element <code>A</code>.
29062910

29072911
<div class="example">
@@ -2937,6 +2941,12 @@ Descendant combinator (<code> </code>)</h3>
29372941
<pre>div p *[href]</pre>
29382942
</div>
29392943

2944+
Note: Note that the whitespace form has existed since CSS Level 1,
2945+
whereas the <code>>></code> form is introduced in Level 4.
2946+
It was introduced to give the descendant combinator a visible, non-whitespace form
2947+
and to bridge the gap between the <a>child combinator</a> (<code>></code>)
2948+
and the shadow-piercing descendant combinator (<code>>>></code>) [[CSS-SCOPING-1]].
2949+
29402950
<h3 id="child-combinators">
29412951
Child combinator (<code>></code>)</h3>
29422952

0 commit comments

Comments
 (0)