Skip to content

[selectors-4] Canonicalize into extlang form prior to :lang() matching #4212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions selectors-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ At Risk: the column combinator
At Risk: [=user action pseudo-classes=] applying to non-[=tree-abiding=] [=pseudo-elements=]
At Risk: the '':blank'' pseudo-class
Ignored Terms: function token, Document, DocumentFragment, math, h1, shadow tree, querySelector(), quirks mode, button, a, span, object, p, div, q, area, link, label, input, html, em, li, ol, pre, CSS Value Definition Syntax
Ignored Vars: identifier, extended filtering, i
Ignored Vars: identifier, i
spec:css-values-4; type:dfn; text:identifier
Expand Down Expand Up @@ -1977,21 +1977,24 @@ The Language Pseudo-class: '':lang()''
e.g. '':lang(\*-Latn)'' or '':lang("*-Latn")''.)

Note: The content language of an element is defined by the document language.
For example, in HTML [[HTML5]], the content language is determined

For example, in HTML [[HTML5]], the content language is determined
by a combination of the lang attribute,
information from meta elements,
and possibly also the protocol (e.g. from HTTP headers).
XML languages can use the xml:lang attribute
to indicate language information for an element. [[XML10]]

An element's content language matches a language range if,
when represented in BCP 47 syntax [[BCP47]],
it matches that language range in an extended filtering
operation per [[RFC4647]] Matching of Language Tags (section 3.3.2).
For this purpose, a wildcard [=language range=] ("*") does not match
elements whose language is not tagged (e.g. lang=""),
but does match elements whose language is tagged as undetermined (lang=und).
The matching is performed [=ASCII case-insensitively=].
The element's content language matches a language range if
its content language, as represented in BCP 47 syntax,
matches the given language range in an extended filtering
operation per [[!RFC4647]] Matching of Language Tags (section 3.3.2).
Both the [=content language=] and the [=language range=]
must be canonicalized
and converted to extlang form as per section 4.5 of [[!RFC5646]]
prior to the extended filtering operation.
The matching is performed case-insensitively within the ASCII range.

The language range does not need to be a valid language code to
perform this comparison.

Expand Down