-
Notifications
You must be signed in to change notification settings - Fork 719
[selectors] :lang
for documents without content language and for elements of unknown language; consider :lang("")
over :not(:lang("*"))
#6915
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
Comments
:lang
for documents without content language and for elements of unknown language; consider :lang("")
over :not(:lang("*"))
:lang
for documents without content language and for elements of unknown language; consider :lang("")
over :not(:lang("*"))
This was discussed at TPAC by the i18n-WG, and the conclusion was that we should have:
|
The CSS Working Group just discussed The full IRC log of that discussion |
|
The CSS Working Group just discussed
The full IRC log of that discussion |
Fixed in 9b51686 |
@fantasai @frivoal Thanks for this fix. Alas, I just now posted some comments related to the change. I can file a new issue if needed. @frivoal I'm closing your action for I18N... |
Should we reopen this issue? Main changes made in
were overwritten by late merge of #4212, so the explicit distinction of |
Ah, thanks for the pointer. I went ahead and restored that text, it was definitely an accidental removal. |
Uh oh!
There was an error while loading. Please reload this page.
Brief questions to answer
:lang("*")
really valid selector? (Safari supports it and Chrome accepted Issue 1281157 to implement it.)
or equivalent
matched by CSS:lang("")
or even:lang()
? (Not yet proposed nor implemented.)or is it something different?
Trivia
lang()
functional pseudo-class to precisely target document without defined content language nor element sub-tree set as such withlang=""
attribute."*-Latn"
or"*-ch"
), opening possibility (loophole?) for matching any specified language value using:lang("*")
and with conjunction with negation pseudo-class opens possibility to use:not(:lang("*"))
for targeting elements that belong to "no specified language" from previous point. While plain"*"
value is not explicitly mentioned in the draft, this reportedly already works in current Safari.lang
attribute and does not come withcontent-language
HTTP header or it's "deprecated nasty"counterpart.
non-linguisticunknown language content it is advised to uselang=""
attribute. While it is possible to target it with attribute selector ([lang=""]
), is does not seem like a right tool and introduces nesting / inheritance problems thatlang()
selector was created for.Pseudo-code samples / introductory use cases
Sample 1: Document without content language
Sample 2: element with unknown language content
Problems
Inability to "legally" target specifically undetermined language document or element seems to be quite minor issue, since most CSS approaches tend to start with "common" defaults and progress to language specific with selector of higher specificity. Like
Sample 3: using specificity or order for refining defaults
However this approach fails short if CSS' author needs to specifically address poorly marked-up document lacking any content language hint
Sample 4: using
body:not(:lang("*"))
for styling "bad" document(Think Sample 3 above. Also notice that samples use CSS features not yet widely implemented - pseudo element alternative texts and system colors - but those are not related for the issue in question.)
Links, resources and notes
lang=""
/xml:lang="und"
lang="zxx"
;The text was updated successfully, but these errors were encountered: