Skip to content

Commit ae35398

Browse files
committed
Add case-insensitive attribute-value matching <http://lists.w3.org/Archives/Public/www-style/2011Jul/0415.html>
1 parent 9236972 commit ae35398

2 files changed

Lines changed: 55 additions & 21 deletions

File tree

selectors4/Overview.html

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515

1616
<h1 id=title>Selectors Level 4</h1>
1717

18-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 24 July 2011</h2>
18+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 25 July 2011</h2>
1919

2020
<dl>
2121
<dt>This version:
2222

23-
<dd> <!-- <a href="http://www.w3.org/TR/2011/ED-selectors4-20110724/">
24-
http://www.w3.org/TR/2011/WD-selectors4-20110724</a> -->
23+
<dd> <!-- <a href="http://www.w3.org/TR/2011/ED-selectors4-20110725/">
24+
http://www.w3.org/TR/2011/WD-selectors4-20110725</a> -->
2525
<a href="http://dev.w3.org/csswg/selectors4">
2626
http://dev.w3.org/csswg/selectors4</a>
2727

@@ -202,16 +202,19 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
202202
<li><a href="#attribute-substrings"><span class=secno>6.2. </span>
203203
Substring matching attribute selectors</a>
204204

205-
<li><a href="#attrnmsp"><span class=secno>6.3. </span> Attribute
205+
<li><a href="#attribute-case"><span class=secno>6.3. </span>
206+
Case-sensitivity</a>
207+
208+
<li><a href="#attrnmsp"><span class=secno>6.4. </span> Attribute
206209
selectors and namespaces</a>
207210

208-
<li><a href="#def-values"><span class=secno>6.4. </span> Default
211+
<li><a href="#def-values"><span class=secno>6.5. </span> Default
209212
attribute values in DTDs</a>
210213

211-
<li><a href="#class-html"><span class=secno>6.5. </span> Class
214+
<li><a href="#class-html"><span class=secno>6.6. </span> Class
212215
selectors</a>
213216

214-
<li><a href="#id-selectors"><span class=secno>6.6. </span> ID
217+
<li><a href="#id-selectors"><span class=secno>6.7. </span> ID
215218
selectors</a>
216219
</ul>
217220

@@ -1350,9 +1353,7 @@ <h3 id=attribute-representation><span class=secno>6.1. </span> Attribute
13501353
<p>Attribute values must be CSS <a
13511354
href="http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier">identifiers</a>
13521355
or <a href="http://www.w3.org/TR/CSS21/syndata.html#strings">strings</a>.
1353-
<a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> The
1354-
case-sensitivity of attribute names and values in selectors depends on the
1355-
document language.
1356+
<a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>
13561357

13571358
<div class=example>
13581359
<p>Examples:</p>
@@ -1434,9 +1435,7 @@ <h3 id=attribute-substrings><span class=secno>6.2. </span> Substring
14341435
<p>Attribute values must be CSS <a
14351436
href="http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier">identifiers</a>
14361437
or <a href="http://www.w3.org/TR/CSS21/syndata.html#strings">strings</a>.
1437-
<a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> The
1438-
case-sensitivity of attribute names in selectors depends on the document
1439-
language.
1438+
<a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>
14401439

14411440
<div class=example>
14421441
<p>Examples:</p>
@@ -1457,7 +1456,27 @@ <h3 id=attribute-substrings><span class=secno>6.2. </span> Substring
14571456
<pre>p[title*="hello"]</pre>
14581457
</div>
14591458

1460-
<h3 id=attrnmsp><span class=secno>6.3. </span> Attribute selectors and
1459+
<h3 id=attribute-case><span class=secno>6.3. </span> Case-sensitivity</h3>
1460+
1461+
<p>By default case-sensitivity of attribute names and values in selectors
1462+
depends on the document language. To match attribute values
1463+
case-insensitively regardless of document language rules, the attribute
1464+
selector may be immediately followed by the identifier <code>i</code>.
1465+
When this flag is present, UAs must match the selector's value
1466+
case-insensitively within the ASCII range.
1467+
1468+
<div class=example>
1469+
<p>The following rule will style the <code>frame</code> attribute when it
1470+
has a value of <code>hsides</code>, whether that value is represented as
1471+
<code>hsides</code>, <code>HSIDES</code>, <code>hSides</code>, etc. even
1472+
in an XML environment where attribute values are case-sensitive.
1473+
1474+
<pre class=example>
1475+
<!-- -->[frame=hsides]i { border-style: solid none; }
1476+
</pre>
1477+
</div>
1478+
1479+
<h3 id=attrnmsp><span class=secno>6.4. </span> Attribute selectors and
14611480
namespaces</h3>
14621481

14631482
<p>The attribute name in an attribute selector is given as a <a
@@ -1499,7 +1518,7 @@ <h3 id=attrnmsp><span class=secno>6.3. </span> Attribute selectors and
14991518
attribute <code>att</code> where the attribute is not in a namespace.</p>
15001519
</div>
15011520

1502-
<h3 id=def-values><span class=secno>6.4. </span> Default attribute values
1521+
<h3 id=def-values><span class=secno>6.5. </span> Default attribute values
15031522
in DTDs</h3>
15041523

15051524
<p>Attribute selectors represent attribute values in the document tree. How
@@ -1558,7 +1577,7 @@ <h3 id=def-values><span class=secno>6.4. </span> Default attribute values
15581577
default case are overridden in the non-default cases' style rules.</p>
15591578
</div>
15601579

1561-
<h3 id=class-html><span class=secno>6.5. </span> Class selectors</h3>
1580+
<h3 id=class-html><span class=secno>6.6. </span> Class selectors</h3>
15621581

15631582
<p>The class selector is given as a full stop (. U+002E) immediately
15641583
followed by an identifier. It represents an element belonging to the class
@@ -1622,7 +1641,7 @@ <h3 id=class-html><span class=secno>6.5. </span> Class selectors</h3>
16221641
however, so this behavior is explicitly non-normative in this
16231642
specification.
16241643

1625-
<h3 id=id-selectors><span class=secno>6.6. </span> ID selectors</h3>
1644+
<h3 id=id-selectors><span class=secno>6.7. </span> ID selectors</h3>
16261645

16271646
<p>Document languages may contain attributes that are declared to be of
16281647
type ID. What makes attributes of type ID special is that no two such

selectors4/Overview.src.html

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -883,8 +883,6 @@ <h3 id=attribute-representation>
883883

884884
<p>Attribute values must be CSS <a href="http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier">identifiers</a>
885885
or <a href="http://www.w3.org/TR/CSS21/syndata.html#strings">strings</a>. [[!CSS21]]
886-
The case-sensitivity of attribute names and values in selectors depends on
887-
the document language.</p>
888886

889887
<div class="example">
890888

@@ -964,8 +962,6 @@ <h3 id=attribute-substrings>
964962

965963
<p>Attribute values must be CSS <a href="http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier">identifiers</a>
966964
or <a href="http://www.w3.org/TR/CSS21/syndata.html#strings">strings</a>. [[!CSS21]]
967-
The case-sensitivity of attribute names in selectors depends on the
968-
document language.</p>
969965

970966
<div class="example">
971967
<p>Examples:</p>
@@ -980,6 +976,25 @@ <h3 id=attribute-substrings>
980976
<pre>p[title*="hello"]</pre>
981977
</div>
982978

979+
<h3 id=attribute-case>
980+
Case-sensitivity</h3>
981+
982+
<p>By default case-sensitivity of attribute names and values in selectors
983+
depends on the document language. To match attribute values case-insensitively
984+
regardless of document language rules, the attribute selector may be immediately
985+
followed by the identifier <code>i</code>. When this flag is present, UAs
986+
must match the selector's value case-insensitively within the ASCII range.
987+
988+
<div class="example">
989+
<p>The following rule will style the <code>frame</code> attribute when it
990+
has a value of <code>hsides</code>, whether that value is represented
991+
as <code>hsides</code>, <code>HSIDES</code>, <code>hSides</code>, etc.
992+
even in an XML environment where attribute values are case-sensitive.
993+
<pre class="example">
994+
<!-- -->[frame=hsides]i { border-style: solid none; }
995+
</pre>
996+
</div>
997+
983998
<h3 id=attrnmsp>
984999
Attribute selectors and namespaces</h3>
9851000

0 commit comments

Comments
 (0)