tor-browser

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

cssstyledeclaration-csstext-all-shorthand.html (1775B)


      1 <!DOCTYPE html>
      2 <title>CSSOM test: serialization of the 'all' shorthand in cssText</title>
      3 <link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
      4 <link rel="help" href="https://drafts.csswg.org/cssom-1/#dom-cssstyledeclaration-csstext">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script>
      8 const style = document.createElement("div").style;
      9 
     10 test(function() {
     11  style.cssText = "all: inherit";
     12  assert_equals(style.cssText, "all: inherit;");
     13 }, "'all' shorthand alone");
     14 
     15 test(function() {
     16  style.cssText = "width: 100px; all: inherit; height: inherit";
     17  assert_equals(style.cssText, "all: inherit;");
     18 }, "'all' shorthand with 'width' and 'height'");
     19 
     20 test(function() {
     21  style.cssText = "direction: ltr; all: inherit; unicode-bidi: plaintext";
     22  assert_equals(style.cssText, "direction: ltr; all: inherit; unicode-bidi: plaintext;");
     23 }, "'all' shorthand with 'direction' and 'unicode-bidi'");
     24 
     25 test(function() {
     26  style.cssText = "width: 100px; --a: a; all: inherit; --b: b; height: inherit";
     27  assert_equals(style.cssText, "--a: a; all: inherit; --b: b;");
     28 }, "'all' shorthand with 'width', 'height' and custom properties");
     29 
     30 test(function() {
     31  let cssText = "all: inherit; ";
     32  for (let longhand of getComputedStyle(document.documentElement)) {
     33    cssText += longhand + ": inherit; ";
     34  }
     35  style.cssText = cssText;
     36  assert_equals(style.cssText, "all: inherit; direction: inherit; unicode-bidi: inherit;");
     37 }, "'all' shorthand with all longhands");
     38 
     39 test(function() {
     40  style.cssText = "--foo: bar; all: initial";
     41  assert_true(style.cssText.includes("--foo: bar"), "cssText serialization includes custom property");
     42 }, "all:initial should not exclude custom from cssText");
     43 </script>