2 <script src=
"../../resources/js-test.js"></script>
4 @namespace url(default);
5 @namespace my-namespace url(http://www.w3.org/
1999/xhtml);
15 description('Check the basic attribute support of CSSOM CSSNamespaceRule');
17 shouldBe('CSSRule.NAMESPACE_RULE','10');
18 var styleSheet
= document
.getElementById("style1").sheet
;
19 var defaultNamespacerule
= styleSheet
.cssRules
[0];
20 var namespacerule
= styleSheet
.cssRules
[1];
21 shouldBe('namespacerule.type','10');
22 shouldBeEqualToString('namespacerule.namespaceURI','http://www.w3.org/1999/xhtml');
23 shouldBeEqualToString('namespacerule.prefix','my-namespace');
24 shouldBeEqualToString('defaultNamespacerule.cssText', '@namespace url("default");');
25 shouldBeEqualToString('namespacerule.cssText', '@namespace my-namespace url("http://www.w3.org/1999/xhtml");');
26 shouldBeEqualToString('getComputedStyle(document.body).color', 'rgb(255, 0, 0)');
28 debug("Deleting namespace rule when other rules are present should throw InvalidStateException.");
30 styleSheet
.deleteRule(namespacerule
);
32 shouldBe(e
.code
, '11');
35 debug("Inserting new namespace rule when other rules are present should throw InvalidStateException.");
37 styleSheet
.insertRule("@namespace new-namespace url('test-namespace');", styleSheet
.cssRules
.length
);
39 shouldBe(e
.code
, '11');