W3C home > Mailing lists > Public > www-style@w3.org > December 2009

Re: Agenda+ CSS Namespaces implementation report

From: Chris Lilley <chris@w3.org>
Date: Tue, 1 Dec 2009 22:34:04 +0100
Message-ID: <1523460187.20091201223404@w3.org>
To: David Hyatt <hyatt@apple.com>
CC: www-style@w3.org
(redirecting to www-style)

On Tuesday, December 1, 2009, 7:58:58 PM, David wrote:

DH> On Dec 1, 2009, at 4:30 AM, Chris Lilley wrote:
CL> Of the four implementations I tested, we have two passes for all
CL> tests except one, which tests @namespace error handling

DH> I looked at this test and am confused about it.  Can you explain why:

DH> <style id="a">@namespace x "test</style>
DH>   <script>
DH>    document.getElementById("a").sheet.insertRule("x|t2 {background:lime }", 1)
DH>   </script>
DH> is supposed to work for the second line in the test case?

I didn't write it but yes, it seems odd to me also.

The content for the second subtest is

<p><t2 xmlns="test">This sentence should have a green background.</t2></p>

The following will make it red:

   t, t2, t3, t4, t5 { background:red }

Now we have

<style id="a">@namespace x "test</style>

which is syntactically invalid. The spec says (section 3.1):

A syntactically invalid @namespace rule (whether malformed or misplaced) must be ignored. A CSS style sheet containing an invalid @namespace rule is itself invalid.

So, there is no namespace prefix "x" in scope as the rule is ignored; and the entire style sheet (the style element)  is invalid. Now we have 

   document.getElementById("a").sheet.insertRule("x|t2 {background:lime }", 1)

which appends a rule, which should not be applied because x|t2 does not match anything.

Unless the stylesheet processor is required to magically fix up the missing closing quote. But I can't see anything to support this.

Firefox applies the rule so has the lime colour. I think this is wrong.

If you agree, the way to fix this test would be to flip the colours for this subtest. Keep this, so implementations with no @namespace support fail:

   t, t2, t3, t4, t5 { background:red }

add this, so @namespace implementations pass

   @namespace "test" {}
   t2 { background:lime }

and set the colour to red in the script-injected style rule

   document.getElementById("a").sheet.insertRule("x|t2 {background:red }", 1)

so that implementations which fail to discard the malformed @namespace rule fail.

 Chris Lilley                    mailto:chris@w3.org
 Technical Director, Interaction Domain
 W3C Graphics Activity Lead
 Co-Chair, W3C Hypertext CG
Received on Tuesday, 1 December 2009 21:34:54 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:13:41 UTC