tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

CSSStyleSheet-constructable-cssRules.html (1174B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>CSSStyleSheet.replace/replaceSync() doesn't change cssRules object</title>
      4 <link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
      5 <link rel="author" href="https://mozilla.org" title="Mozilla">
      6 <link rel="help" href="https://drafts.csswg.org/cssom/#extensions-to-the-document-or-shadow-root-interface">
      7 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1752392">
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <span>Should be green</span>
     11 <script>
     12 promise_test(async function() {
     13  const sheet = new CSSStyleSheet();
     14  let rules = sheet.cssRules;
     15  sheet.replaceSync('span {color:blue;}');
     16  assert_equals(rules, sheet.cssRules, "Rules should be the same after replaceSync");
     17  await sheet.replace('span {color: lime;}');
     18  assert_equals(rules, sheet.cssRules, "Rules should be the same after replace()");
     19  document.adoptedStyleSheets = [sheet];
     20  assert_equals(getComputedStyle(document.querySelector("span")).color, "rgb(0, 255, 0)", "Sheet should apply");
     21 }, "cssRules doesn't change on replace / replaceSync");
     22 </script>