Re: Error in CSS1 test §7.1 (CSS2 language selector)

On Wed, 2004-06-09 at 15:20, Tantek Çelik wrote:
> On 6/9/04 8:24 AM, "Ben Winslow" <rain@bluecherry.net> wrote:

> > I'm using a Gecko-based UA, and it appears that Gecko will match the
> > :lang pseudo-class using the languages configured for Accept-Languages
> > (pref intl.accept_languages) in the absence of a document-specified
> > language.  This seems like an acceptable behavior,
> 
> That is not acceptable behavior and is a bug.
> 
> Accept-Language is purely a client preference and has nothing to do with the
> document.
> 
> There are only two ways I know of offhand that the document language can be
> inferred.
> 
> 1. HTTP Header *response* Content-Language field
>     (or the <meta> http-equiv equivalent)
> 2. 'lang' attribute on an element, or if absent, the nearest ancestor with a
> 'lang' attribute, and if none, then inferred from 1.

While it seems reasonable to assume that a document will be in one of
the user's configured languages (if the user is paying enough attention
to the document that the CSS definitions matter, anyway), I can
certainly see the value in consistent behavior.

> None of that is present in the test case nor the HTTP response header[1].
> Therefore there is no specified language for the document (nor for any of
> its elements).  Therefore a language selector for a specific language can
> never apply to any element in the document.

I'll open a bug against Mozilla when I get the chance (citing CSS 2.1 §
5.11.4[1] and HTML 4.0 § 8.1[2], unless anyone suggests something
better.)

> > I should also note that the <span> that follows shortly after does NOT
> > appear to match (the CSS specifies SPAN[lang|="fr"]), although I'm
> > uncertain as to whether this is the correct behavior (i.e. specified
> > differences between :lang and [lang|=]) or an inconsistency in the UA.
> 
> This is a common misconception.
> 
> :lang and [lang|=] are *very* different.
> 
> [foo|=] only tests the 'foo' attribute *of a specific element*.
> 
> Thus [lang|=] can *only* apply to an element that *itself* has a 'lang'
> attribute that matches the value given appropriately.

This was the way I understood it, but I wasn't certain that I'd
interpreted the spec correctly.  Thank you for the clarification.

> Tantek

[1] http://www.w3.org/TR/CSS21/selector.html#lang
[2] http://www.w3.org/TR/REC-html40/struct/dirlang.html#h-8.1
-- 
Ben Winslow <rain@bluecherry.net>

Received on Wednesday, 9 June 2004 18:56:19 UTC