- From: Chris Lilley <chris@w3.org>
- Date: Tue, 1 Dec 2009 22:34:04 +0100
- 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: <style> t, t2, t3, t4, t5 { background:red } </style> 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 <script> document.getElementById("a").sheet.insertRule("x|t2 {background:lime }", 1) </script> 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: <style> t, t2, t3, t4, t5 { background:red } </style> add this, so @namespace implementations pass <style> @namespace "test" {} t2 { background:lime } </style> and set the colour to red in the script-injected style rule <script> document.getElementById("a").sheet.insertRule("x|t2 {background:red }", 1) </script> 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