Skip to content

Commit de57526

Browse files
committed
[selectors-4] Add case-sensitive attribute matching flag 's'. #2101
1 parent 77a9aa4 commit de57526

1 file changed

Lines changed: 41 additions & 6 deletions

File tree

selectors-4/Overview.bs

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ Selectors Overview</h2>
181181
exactly equal to any (ASCII-range) case-permutation of <code>bar</code>
182182
<td>[[#attribute-case]]
183183
<td>4
184+
<tr>
185+
<td><code>E[foo="bar" s]</code>
186+
<td>an E element whose <code>foo</code> attribute value is
187+
exactly and case-sensitively equal to <code>bar</code>
188+
<td>[[#attribute-case]]
189+
<td>4
184190
<tr>
185191
<td><code>E[foo~="bar"]</code>
186192
<td>an E element whose <code>foo</code> attribute value is
@@ -1568,14 +1574,24 @@ Substring matching attribute selectors</h3>
15681574
Case-sensitivity</h3>
15691575

15701576
By default case-sensitivity of attribute names and values in selectors
1571-
depends on the document language. To match attribute values case-insensitively
1572-
regardless of document language rules, the attribute selector may include the
1573-
identifier <code>i</code> before the closing bracket (<code>]</code>).
1574-
When this flag is present, UAs must match the attribute's value
1577+
depends on the document language.
1578+
1579+
To match attribute values case-insensitively
1580+
regardless of document language rules,
1581+
the attribute selector may include the identifier <code>i</code>
1582+
before the closing bracket (<code>]</code>).
1583+
When this flag is present,
1584+
UAs must match the attribute's value
15751585
case-insensitively within the ASCII range.
1586+
1587+
Alternately, the attribute selector may include the identifier <code>s</code>
1588+
before the closing bracket (<code>]</code>);
1589+
in this case the UA must match the value case-sensitively (if possible)
1590+
regardless of document language rules.
1591+
15761592
Like the rest of Selectors syntax,
1577-
the <code>i</code> identifier is <a href="#case-sensitive">case-insensitive</a>
1578-
within the ASCII range.
1593+
the <code>i</code> and <code>s</code> identifiers are
1594+
<a href="#case-sensitive">case-insensitive</a> within the ASCII range.
15791595

15801596
<div class="example">
15811597
The following rule will style the <code>frame</code> attribute when it
@@ -1586,11 +1602,28 @@ Case-sensitivity</h3>
15861602
<pre>[frame=hsides i] { border-style: solid none; } </pre>
15871603
</div>
15881604

1605+
<div class="example">
1606+
The following rule will style lists with <code>type="a"</code>
1607+
attributes differently than <code>type="A"</code>
1608+
even though HTML defines the <code>type</code> attribute
1609+
to be case-insensitive.
1610+
1611+
<pre>
1612+
[type="a" s] { list-style: lower-alpha; }
1613+
[type="A" s] { list-style: upper-alpha; }
1614+
</pre>
1615+
</div>
1616+
15891617
<!-- plinss notes we may eventually want to choose other normalizations
15901618
for attribute matching; but since there's no normalization scheme
15911619
that really seems needed at this point, this issue is deferred to
15921620
a later level -->
15931621

1622+
Note: Some document models normalize case-insensitive attribute values
1623+
at parse time such that case-sensitive matching is impossible.
1624+
Case-sensitive matching via <code>s</code> flags is only possible
1625+
in systems that preserve the original case.
1626+
15941627
<h3 id="attrnmsp">
15951628
Attribute selectors and namespaces</h3>
15961629

@@ -3863,6 +3896,8 @@ Changes</h2>
38633896
(<a href="https://github.com/w3c/csswg-drafts/issues/1027">Issue 1027</a>)
38643897
<li>Dropped the '':drop()'' pseudo-classes since HTML dropped the related feature.
38653898
(<a href="https://github.com/w3c/csswg-drafts/issues/2257">Issue 2257</a>)
3899+
<li>Added the case-sensitive flag <code>s</code> to the attribute selector.
3900+
(<a href="https://github.com/w3c/csswg-drafts/issues/2101">Issue 2101</a>)
38663901
</ul>
38673902

38683903
Significant changes since the <a href="https://www.w3.org/TR/2013/WD-selectors4-20130502/">2 May 2013 Working Draft</a> include:

0 commit comments

Comments
 (0)