test_ua_rule_modification.html (895B)
1 <!DOCTYPE html> 2 <title>Test for bug 1539159</title> 3 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 4 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/> 5 <p></p> 6 <script> 7 function start() { 8 let rules = InspectorUtils.getMatchingCSSRules(document.querySelector("p")); 9 ok(rules.length > 0, "Should have found some rules"); 10 is(rules[0].type, CSSRule.STYLE_RULE, "Should have found a style rule"); 11 12 let selector = rules[0].selectorText; 13 isnot(selector, ".xxxxx", "Rule selector should not be something strange"); 14 15 try { 16 rules[0].selectorText = "img"; 17 } catch (ex) { 18 } 19 is(rules[0].selectorText, selector, "Selector text should be unchanged"); 20 21 SimpleTest.finish(); 22 } 23 24 SimpleTest.waitForExplicitFinish(); 25 document.addEventListener('DOMContentLoaded', start) 26 </script>