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