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