set-selector-text-attachment.html (839B)
1 <!DOCTYPE html> 2 <title>Setting selectorText does not detach rule</title> 3 <link rel="help" href="https://drafts.csswg.org/cssom-1/#dom-cssstylerule-selectortext"> 4 <link rel="help" href="https://issues.chromium.org/issues/396612327"> 5 <script src=/resources/testharness.js></script> 6 <script src=/resources/testharnessreport.js></script> 7 <style id=sheet> 8 span { 9 color: black; 10 } 11 </style> 12 <div> 13 <span id=span>A</span> 14 </div> 15 <script> 16 test(() => { 17 let rule = sheet.sheet.cssRules[0]; 18 let style = rule.style; 19 20 style.color = 'red'; 21 assert_equals(getComputedStyle(span).color, 'rgb(255, 0, 0)'); 22 23 rule.selectorText = '#span'; 24 25 style.color = 'green'; 26 assert_equals(getComputedStyle(span).color, 'rgb(0, 128, 0)'); 27 }, 'Modifying property value invalidates style, even after selectorText mutation'); 28 </script>