tor-browser

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

browser_rules_inherited-properties_02.js (996B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Check that no inherited properties appear when the property does not apply
      7 // to the nested element.
      8 
      9 const TEST_URI = `
     10  <style type="text/css">
     11    #test2 {
     12      background-color: green;
     13    }
     14  </style>
     15  <div id="test2"><div id="test1">Styled Node</div></div>
     16 `;
     17 
     18 add_task(async function () {
     19  await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
     20  const { inspector, view } = await openRuleView();
     21  await selectNode("#test1", inspector);
     22  await emptyInherit(inspector, view);
     23 });
     24 
     25 function emptyInherit(inspector, view) {
     26  // No inheritable styles, this rule shouldn't show up.
     27  const elementStyle = view._elementStyle;
     28  is(elementStyle.rules.length, 1, "Should have 1 rule.");
     29 
     30  const elementRule = elementStyle.rules[0];
     31  ok(
     32    !elementRule.inherited,
     33    "Element style attribute should not consider itself inherited."
     34  );
     35 }