- From: Tantek Çelik <tantek@cs.stanford.edu>
- Date: Wed, 09 Jun 2004 12:20:40 -0700
- To: Ben Winslow <rain@bluecherry.net>, <public-css-testsuite@w3.org>
On 6/9/04 8:24 AM, "Ben Winslow" <rain@bluecherry.net> wrote: > Hello, > > I noticed a small error in the CSS1 test suite (section 7.1, > "Forward-compatible parsing", > http://www.w3.org/Style/CSS/Test/CSS1/current/sec71.htm): the document > has no language specified on any element, yet relies on the document > language in a couple of CSS2 selectors. I disagree. The tests do not rely on the document language. The tests make sure that the document language isn't incorrectly inferred/assumed. > 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. 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. > but it causes > unexpected output when I view the CSS1 test suite (as mentioned above) > because I have French in my list of accepted languages. Nothing in that test page implies a 'lang' of 'fr', therefore, the :lang(fr) selector should always be false and should never select any element. > Specifically, > the <ul> item "This unordered list item should be black, because, > according to CSS1, the selector is invalid, and according to CSS2, the > selector should not apply." appears in gray, because the CSS2 selector > *did* apply. See above. In CSS2, the selector does *not* apply. > 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. :lang matches the *language* of the element. The language of the element is determined as I described above. Yes, the 'lang' attribute on the element does take part in this determination, but so does potentially the 'lang' attribute of an ancestor or what is sent in the HTTP header. Tantek [1] response header from <http://www.w3.org/Style/CSS/Test/CSS1/current/test71.htm> HTTP/1.1 200 OK Date: Wed, 09 Jun 2004 19:05:06 GMT Server: Apache/1.3.28 (Unix) PHP/4.2.3 P3P: policyref="http://www.w3.org/2001/05/P3P/p3p.xml" Cache-Control: max-age=21600 Expires: Thu, 10 Jun 2004 01:05:06 GMT Last-Modified: Mon, 29 Sep 2003 17:43:47 GMT ETag: "3f786f53" Accept-Ranges: bytes Content-Length: 16358 Connection: close Content-Type: text/html; charset=iso-8859-1
Received on Wednesday, 9 June 2004 15:19:27 UTC