OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/js-test.js"></script> |
| 3 <style id="style1"> |
| 4 @namespace url(default); |
| 5 @namespace my-namespace url(http://www.w3.org/1999/xhtml); |
| 6 body { |
| 7 color:black; |
| 8 } |
| 9 my-namespace|body { |
| 10 color:red; |
| 11 } |
| 12 </style> |
| 13 Here is some text! |
| 14 <script> |
| 15 description('Check the basic attribute support of CSSOM CSSNamespaceRule'); |
| 16 |
| 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("htt
p://www.w3.org/1999/xhtml");'); |
| 26 shouldBeEqualToString('getComputedStyle(document.body).color', 'rgb(255, 0, 0)')
; |
| 27 |
| 28 debug("Deleting namespace rule when other rules are present should throw Invalid
StateException."); |
| 29 try { |
| 30 styleSheet.deleteRule(namespacerule); |
| 31 } catch (e) { |
| 32 shouldBe(e.code, '11'); |
| 33 } |
| 34 |
| 35 debug("Inserting new namespace rule when other rules are present should throw In
validStateException."); |
| 36 try { |
| 37 styleSheet.insertRule("@namespace new-namespace url('test-namespace');",
styleSheet.cssRules.length); |
| 38 } catch (e) { |
| 39 shouldBe(e.code, '11'); |
| 40 } |
| 41 |
| 42 </script> |
OLD | NEW |