Skip to content

Commit ea601f3

Browse files
committed
Clarified that language codes must be well-formed to match, #8720
1 parent e2ca4ff commit ea601f3

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

selectors-4/Overview.bs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2640,9 +2640,27 @@ The Language Pseudo-class: '':lang()''</h3>
26402640
prior to the <i>extended filtering</i> operation.
26412641
The matching is performed [=ASCII case-insensitively=].
26422642

2643-
The <a>language range</a> does not need to be a valid language code to
2643+
The <a>language range</a>
2644+
must be <em>well-formed</em> according to the syntax of BCP 47 in order to match.
2645+
However, it does not need to be a <em>valid</em> language code to
26442646
perform this comparison.
26452647

2648+
<div class="example">
2649+
For example,
2650+
<pre class="lang-css">
2651+
:lang(åå)
2652+
</pre>
2653+
would not match,
2654+
because it containins non-ASCII characters so is ill-formed.
2655+
2656+
On the other hand,
2657+
<pre class="lang-css">
2658+
:lang(qq)
2659+
</pre>
2660+
could match,
2661+
even though qq is not a registered language code.
2662+
</div>
2663+
26462664
For this purpose, a wildcard [=language range=] (<code>"*"</code>)
26472665
does not match elements whose language is not tagged (e.g. <code>lang=""</code>),
26482666
but does match elements whose language is tagged as undetermined (<code>lang=und</code>).

0 commit comments

Comments
 (0)