tor-browser

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

browser_rules_variables-in-pseudo-element_02.js (904B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test for pseudo element which inherits CSS variable.
      7 
      8 const TEST_URI = `
      9  <style type='text/css'>
     10    div::before {
     11      color: var(--color);
     12    }
     13 
     14    div {
     15      color: var(--color);
     16      --color: lime;
     17    }
     18  </style>
     19  <div></div>
     20 `;
     21 
     22 add_task(async function () {
     23  await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
     24  const { inspector, view } = await openRuleView();
     25  await selectNode("div", inspector);
     26 
     27  info("Test the CSS variable which normal element is referring to");
     28  checkCSSVariableOutput(view, "div", "color", "inspector-variable", "lime");
     29 
     30  info("Test the CSS variable which pseudo element is referring to");
     31  checkCSSVariableOutput(
     32    view,
     33    "div::before",
     34    "color",
     35    "inspector-variable",
     36    "lime"
     37  );
     38 });