Skip to content

Commit f922229

Browse files
committed
Reorder a couple sections, add :any() as :matches()
1 parent bda4f8d commit f922229

2 files changed

Lines changed: 193 additions & 141 deletions

File tree

selectors4/Overview.html

Lines changed: 110 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,27 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
138138
<li><a href="#structure"><span class=secno>3. </span> Selector Syntax and
139139
Structure</a>
140140
<ul class=toc>
141-
<li><a href="#namespaces"><span class=secno>3.1. </span> Namespaces</a>
142-
143-
<li><a href="#case-sensitive"><span class=secno>3.2. </span> Characters
141+
<li><a href="#case-sensitive"><span class=secno>3.1. </span> Characters
144142
and case sensitivity</a>
145143

144+
<li><a href="#namespaces"><span class=secno>3.2. </span> Namespaces</a>
145+
146146
<li><a href="#invalid"><span class=secno>3.3. </span> Invalid Selectors
147147
and Error Handling</a>
148148
</ul>
149149

150-
<li><a href="#grouping"><span class=secno>4. </span> Groups of
151-
selectors</a>
150+
<li><a href="#logical-combination"><span class=secno>4. </span> Logical
151+
Combinations</a>
152+
<ul class=toc>
153+
<li><a href="#grouping"><span class=secno>4.1. </span> Groups of
154+
selectors </a>
155+
156+
<li><a href="#matches"><span class=secno>4.2. </span> The Matches-Any
157+
Psuedo-class: &lsquo;<code class=css>:matches()</code>&rsquo;</a>
158+
159+
<li><a href="#negation"><span class=secno>4.3. </span> The Negation
160+
Pseudo-class: &lsquo;<code class=css>:not()</code>&rsquo;</a>
161+
</ul>
152162

153163
<li><a href="#elemental-selectors"><span class=secno>5. </span> Elemental
154164
selectors</a>
@@ -261,9 +271,6 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
261271
<li><a href="#empty-pseudo"><span class=secno>7.4.12. </span> :empty
262272
pseudo-class</a>
263273
</ul>
264-
265-
<li><a href="#negation"><span class=secno>7.5. </span> The negation
266-
pseudo-class</a>
267274
</ul>
268275

269276
<li><a href="#combinators"><span class=secno>8. </span> Combinators</a>
@@ -815,18 +822,7 @@ <h2 id=structure><span class=secno>3. </span> Selector Syntax and Structure</h2>
815822
<p>An empty selector, containing no compound selector, is an <a
816823
href="#invalid">invalid selector</a>.
817824

818-
<h3 id=namespaces><span class=secno>3.1. </span> Namespaces</h3>
819-
820-
<p>Certain selectors support namespace prefixes. The mechanism by which
821-
namespace prefixes are <dfn id=declared>declared</dfn> should be specified
822-
by the language that uses Selectors. If the language does not specify a
823-
namespace prefix declaration mechanism, then no prefixes are declared. In
824-
CSS, namespace prefixes are declared with the <a
825-
href="http://www.w3.org/TR/css3-namespace/#declaration"><code>@namespace</code></a>
826-
rule. <a href="#CSS3NAMESPACE"
827-
rel=biblioentry>[CSS3NAMESPACE]<!--{{!CSS3NAMESPACE}}--></a>
828-
829-
<h3 id=case-sensitive><span class=secno>3.2. </span> Characters and case
825+
<h3 id=case-sensitive><span class=secno>3.1. </span> Characters and case
830826
sensitivity</h3>
831827

832828
<p>All Selectors syntax is case-insensitive within the ASCII range (i.e.
@@ -843,6 +839,17 @@ <h3 id=case-sensitive><span class=secno>3.2. </span> Characters and case
843839
rules</a> as CSS. <a href="#CSS21"
844840
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>.
845841

842+
<h3 id=namespaces><span class=secno>3.2. </span> Namespaces</h3>
843+
844+
<p>Certain selectors support namespace prefixes. The mechanism by which
845+
namespace prefixes are <dfn id=declared>declared</dfn> should be specified
846+
by the language that uses Selectors. If the language does not specify a
847+
namespace prefix declaration mechanism, then no prefixes are declared. In
848+
CSS, namespace prefixes are declared with the <a
849+
href="http://www.w3.org/TR/css3-namespace/#declaration"><code>@namespace</code></a>
850+
rule. <a href="#CSS3NAMESPACE"
851+
rel=biblioentry>[CSS3NAMESPACE]<!--{{!CSS3NAMESPACE}}--></a>
852+
846853
<h3 id=invalid><span class=secno>3.3. </span> Invalid Selectors and Error
847854
Handling</h3>
848855

@@ -852,16 +859,24 @@ <h3 id=invalid><span class=secno>3.3. </span> Invalid Selectors and Error
852859
<p>User agents must observe the rules for handling parsing errors:
853860

854861
<ul>
855-
<li>a simple selector containing an <a href="#nsdecl">undeclared namespace
856-
prefix</a> is invalid
862+
<li>a simple selector containing an <a href="#namespaces">undeclared
863+
namespace prefix</a> is invalid
857864

858865
<li>a selector containing an invalid simple selector, an invalid
859866
combinator or an invalid token is invalid.
860867

861868
<li>a group of selectors containing an invalid selector is invalid.
862869
</ul>
863870

864-
<h2 id=grouping><span class=secno>4. </span> Groups of selectors</h2>
871+
<p class=issue>It's been <a
872+
href="http://lists.w3.org/Archives/Public/www-style/2010Nov/0203.html">requested</a>
873+
that the last rule be dropped in favor of Media Queries-style
874+
error-handling.
875+
876+
<h2 id=logical-combination><span class=secno>4. </span> Logical
877+
Combinations</h2>
878+
879+
<h3 id=grouping><span class=secno>4.1. </span> Groups of selectors</h3>
865880

866881
<p>A comma-separated list of selectors represents the union of all elements
867882
selected by each of the individual selectors in the list. (A comma is
@@ -907,6 +922,78 @@ <h2 id=grouping><span class=secno>4. </span> Groups of selectors</h2>
907922
grouped, only the rule for <code>h2..foo</code> is dropped.)</p>
908923
</div>
909924

925+
<h3 id=matches><span class=secno>4.2. </span> The Matches-Any Psuedo-class:
926+
&lsquo;<code class=css>:matches()</code>&rsquo;</h3>
927+
928+
<p>The <code>:matches(<var>X</var>)</code> pseudo-class is a functional
929+
notation taking a comma-separated list of <a href="#compound">compound
930+
selectors</a> as an argument. It represents an element that is represented
931+
by any of its arguments.
932+
933+
<p><code>:matches()</code> may not be nested;
934+
<code>:matches(:matches(...))</code> is invalid. Also pseudo-elements are
935+
not valid within <code>:matches()</code>.
936+
937+
<p>Default namespace declarations do not affect the argument of the
938+
matches-any pseudo-class unless the argument is a universal selector or a
939+
type selector. (See below for examples.)
940+
941+
<h3 id=negation><span class=secno>4.3. </span> The Negation Pseudo-class:
942+
&lsquo;<code class=css>:not()</code>&rsquo;</h3>
943+
944+
<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
945+
functional notation taking a comma-separated list of <a
946+
href="#compound">compound selectors</a> as an argument. It represents an
947+
element that is not represented by any of its arguments.
948+
949+
<p>Negations may not be nested; <code>:not(:not(...))</code> is invalid.
950+
Also pseudo-elements are not valid within <code>:not()</code>.
951+
952+
<div class=example>
953+
<p>Examples:</p>
954+
955+
<p>The following selector matches all <code>button</code> elements in an
956+
HTML document that are not disabled.</p>
957+
958+
<pre>button:not([DISABLED])</pre>
959+
960+
<p>The following selector represents all but <code>FOO</code> elements.</p>
961+
962+
<pre>*:not(FOO)</pre>
963+
964+
<p>The following group of selectors represents all HTML elements except
965+
links.</p>
966+
967+
<pre>html|*:not(:link):not(:visited)</pre>
968+
</div>
969+
970+
<p>Default namespace declarations do not affect the argument of the
971+
negation pseudo-class unless the argument is a universal selector or a
972+
type selector.
973+
974+
<div class=example>
975+
<p>Examples:</p>
976+
977+
<p>Assuming that the default namespace is bound to "http://example.com/",
978+
the following selector represents all elements that are not in that
979+
namespace:</p>
980+
981+
<pre>*|*:not(*)</pre>
982+
983+
<p>The following selector matches any element that is not being hovered,
984+
regardless of its namespace. In particular, it is not limited to only
985+
matching elements in the default namespace that are not being hovered,
986+
and elements not in the default namespace don't match the rule when they
987+
<em>are</em> being hovered.</p>
988+
989+
<pre>*|*:not(:hover)</pre>
990+
</div>
991+
992+
<p class=note><strong>Note</strong>: the :not() pseudo allows useless
993+
selectors to be written. For instance <code>:not(*|*)</code>, which
994+
represents no element at all, or <code>foo:not(bar)</code>, which is
995+
equivalent to <code>foo</code> but with a higher specificity.
996+
910997
<h2 id=elemental-selectors><span class=secno>5. </span> Elemental selectors</h2>
911998

912999
<h3 id=type-selectors><span class=secno>5.1. </span> Type selector</h3>
@@ -2134,62 +2221,6 @@ <h4 id=empty-pseudo><span class=secno>7.4.12. </span> :empty pseudo-class</h4>
21342221
<pre>&lt;foo&gt;this is not &lt;bar&gt;:empty&lt;/bar&gt;&lt;/foo&gt;</pre>
21352222
</div>
21362223

2137-
<h3 id=negation><span class=secno>7.5. </span> The negation pseudo-class</h3>
2138-
2139-
<p>The negation pseudo-class, <code>:not(<var>X</var>)</code>, is a
2140-
functional notation taking a <a href="#simple-selectors-dfn">simple
2141-
selector</a> (excluding the negation pseudo-class itself) as an argument.
2142-
It represents an element that is not represented by its argument.
2143-
2144-
<p>Negations may not be nested; <code>:not(:not(...))</code> is invalid.
2145-
Note also that since pseudo-elements are not simple selectors, they are
2146-
not a valid argument to <code>:not()</code>.
2147-
2148-
<div class=example>
2149-
<p>Examples:</p>
2150-
2151-
<p>The following selector matches all <code>button</code> elements in an
2152-
HTML document that are not disabled.</p>
2153-
2154-
<pre>button:not([DISABLED])</pre>
2155-
2156-
<p>The following selector represents all but <code>FOO</code> elements.</p>
2157-
2158-
<pre>*:not(FOO)</pre>
2159-
2160-
<p>The following group of selectors represents all HTML elements except
2161-
links.</p>
2162-
2163-
<pre>html|*:not(:link):not(:visited)</pre>
2164-
</div>
2165-
2166-
<p>Default namespace declarations do not affect the argument of the
2167-
negation pseudo-class unless the argument is a universal selector or a
2168-
type selector.
2169-
2170-
<div class=example>
2171-
<p>Examples:</p>
2172-
2173-
<p>Assuming that the default namespace is bound to "http://example.com/",
2174-
the following selector represents all elements that are not in that
2175-
namespace:</p>
2176-
2177-
<pre>*|*:not(*)</pre>
2178-
2179-
<p>The following selector matches any element that is not being hovered,
2180-
regardless of its namespace. In particular, it is not limited to only
2181-
matching elements in the default namespace that are not being hovered,
2182-
and elements not in the default namespace don't match the rule when they
2183-
<em>are</em> being hovered.</p>
2184-
2185-
<pre>*|*:not(:hover)</pre>
2186-
</div>
2187-
2188-
<p class=note><strong>Note</strong>: the :not() pseudo allows useless
2189-
selectors to be written. For instance <code>:not(*|*)</code>, which
2190-
represents no element at all, or <code>foo:not(bar)</code>, which is
2191-
equivalent to <code>foo</code> but with a higher specificity.
2192-
21932224
<h2 id=combinators><span class=secno>8. </span> Combinators</h2>
21942225

21952226
<h3 id=descendant-combinators><span class=secno>8.1. </span> Descendant

0 commit comments

Comments
 (0)