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

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

From: Justin Rogers <justrog@microsoft.com>
Date: Sat, 5 Jul 2008 13:30:16 -0700
To: fantasai <fantasai.lists@inkedblade.net>, Bert Bos <bert@w3.org>
CC: "www-style@w3.org" <www-style@w3.org>
Message-ID: <00BD06E707F60B4F9D6A3E75C712209D53DBCDEAAD@NA-EXMSG-C104.redmond.corp.microsoft.com>

[Bert Bos]
> So the ':lang()' applied to an HTML document is indeed case-sensitive,
> but there may be other documents for which it is different.

Clarification, I hope that should read case-insensitive. In HTML 4.01 lang is a CI attribute.
        lang = language-code [CI]
        This attribute specifies the base language of an element's attribute values and text content. The default value of this attribute is unknown

I don't have much to offer, but as a data point, IE will parse, but does not understand XHTML. So it gets treated like HTML. For the most part this just works since it does fall into our standards mode and ID's, classes, etc... are all case-sensitive. We will, however, treat the :lang selector in the case of the document language (maybe an overstatement, we assume we don't support any documents that would be CS), which in this case we assume is some form of HTML and therefore CI. This causes me to lean towards the :lang selector always being CI, there is very little author productivity gain from making it CS.

A second data point here is this is a single "special" attribute selector. The compatibility table between browsers when you start to look at all attributes gets even worse. Leaving things to the document language, and the implementer's understanding of those document language specs, has left things kind of messy.

Justin Rogers [MSFT]

-----Original Message-----
From: www-style-request@w3.org [mailto:www-style-request@w3.org] On Behalf Of fantasai
Sent: Saturday, July 05, 2008 11:30 AM
To: Bert Bos
Cc: www-style@w3.org
Subject: Re: [CSS21] [css3-selectors] case-sensitivity of :lang()


Bert Bos wrote:
>
> 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.
>>
>> Proposed that in
>>   http://www.w3.org/TR/CSS21/selector.html#lang
>> and
>>   http://www.w3.org/TR/css3-selectors/#lang-pseudo
>> the phrase
>>   "in the same way as if performed by the '|=' operator."
>> be replaced by
>>   "in the same way as if performed by the '|=' operator
>>    except that in this case a case-insensitive match is
>>    performed."
>
> It's only case-insensitive if the document is. That's covered already by
> section 4.1.3, which says that text from the document is case-sensitive
> iff the document says it is.
>
> So the ':lang()' applied to an HTML document is indeed case-sensitive,
> but there may be other documents for which it is different.

:lang() information can come from places other than the document.
Also it's not clear to me for XML whether the case-sensitivity of
xml:lang from from XML's case-sensitivity rules and the string-
matching concept (in which case it is case-sensitive) or from
RFC 3066/RFC 4646's rules being applied to this particular attribute
(in which case it is not).

~fantasai
Received on Saturday, 5 July 2008 20:31:00 GMT

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