computed-style-set-property.html (1711B)
1 <!DOCTYPE html> 2 <title>NoModificationAllowedError when mutating read only properties</title> 3 <link rel="help" href="https://www.w3.org/TR/cssom-1/#dom-cssstyledeclaration-setpropertyvalue"> 4 <meta name="assert" content="This test verifies that NoModificationAllowedError is thrown when mutating read only properties" /> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <body></body> 8 <script> 9 test(function(t) { 10 assert_equals(document.defaultView.getComputedStyle(document.body, null).parentRule, null); 11 }, "Computed style parent (should be null)"); 12 13 test(function(t) { 14 assert_throws_dom("NoModificationAllowedError", function() { 15 document.defaultView.getComputedStyle(document.body, null).color = "blue"; 16 }); 17 }, "Exception thrown when trying to change a computed style declaration via property"); 18 19 test(function(t) { 20 assert_throws_dom("NoModificationAllowedError", function() { 21 document.defaultView.getComputedStyle(document.body, null).setProperty("color", "blue"); 22 }); 23 }, "Exception thrown when trying to change a computed style declaration via setProperty"); 24 25 test(function(t) { 26 assert_throws_dom("NoModificationAllowedError", function() { 27 document.defaultView.getComputedStyle(document.body, null).webkitTransition = ""; 28 }); 29 }, "Exception thrown when trying to change a computed style alias via property"); 30 31 test(function(t) { 32 assert_throws_dom("NoModificationAllowedError", function() { 33 document.defaultView.getComputedStyle(document.body, null).setProperty("webkitTransition", ""); 34 }); 35 }, "Exception thrown when trying to change a computed style alias via setProperty"); 36 </script>