W3C home > Mailing lists > Public > www-style@w3.org > July 2008

Re: [CSS21] [css3-selectors] case-sensitivity of :lang()

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Sun, 06 Jul 2008 13:42:45 +0200
To: fantasai <fantasai.lists@inkedblade.net>
Cc: www-style@w3.org
Message-ID: <5ka1741cee051htsre67e8sufsiv35fb5n@hive.bjoern.hoehrmann.de>

* fantasai wrote:
>Currently :lang() is defined as doing |= match against the
>language string (normalized to RFC 3066 format per [1]).
>It's not clear whether this match is case-sensitive or
>case-insensitive. Since language codes are case-insensitive,
>I believe this match should be case-insensitive. I've tested
>Opera, Safari, and Firefox, and they agree.

So long as we do not define the format of the argument to :lang, there
is nothing to say about this. It is assumed other specifications define
in effect a boolean function Compare(Element, LanguageIdentifier), and
whether that considers "en" and "EN" the same, or "Deutsch" and "German"
the same, or 1033 and en-US the same, is entirely up to the definition
of the comparison function.

Of course it usually leads to confusion to specify the behavior of pro-
cesses, rather than intrinsic semantics, so specifications will often
rather say "de" and "DE" both denote the same language. By saying that
an attribute value takes a BCP 47 language tag, you say exactly that
(an element in 'de' is also in 'DE' and 'dE' and 'De') so your question
should almost never arise, and where it does come up, we wouldn't really
know the right answer independently of the specific case. So I do not
think we need to change either specification in this regard.

In theory, and last I checked implementations disagreed a lot, the same
is true for attribute values aswell, although the selector specification
only talks about case-sensitivity there, when a specification says that
example='X' is the same as example='x' then [example='x'] is supposed to
match in both cases and the same goes for the other selectors. Saying
that example=' X ' and example='X' are the same, is not supposed to have
effect on whether selectors match, however (unless perhaps, say, the two
end up exactly the same in the DOM).
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Sunday, 6 July 2008 11:43:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:10 GMT