tor-browser

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

hidden-elements.html (1856B)


      1 <!doctype html>
      2 <link rel=help href="https://html.spec.whatwg.org/#hidden-elements">
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <div hidden></div>
      6 <embed hidden>
      7 <embed hidden=until-found>
      8 <script>
      9 const kNotHiddenElementLocalNames = [
     10  "source", "track",
     11 ];
     12 
     13 const kHiddenElementLocalNames = [
     14  "area", "base", "basefont", "datalist", "head", "link", "meta", "noembed",
     15  "noframes", "param", "rp", "script", "style", "template", "title",
     16 ];
     17 
     18 for (let name of kNotHiddenElementLocalNames) {
     19  test(function() {
     20    let element = document.createElement(name);
     21    document.body.appendChild(element);
     22    assert_equals(getComputedStyle(element).display, "inline");
     23  }, `${name} should not be hidden`);
     24 }
     25 
     26 for (let name of kHiddenElementLocalNames) {
     27  test(function() {
     28    let element = document.createElement(name);
     29    document.body.appendChild(element);
     30    assert_equals(getComputedStyle(element).display, "none");
     31  }, `${name} should be hidden`);
     32 }
     33 
     34 test(function() {
     35  assert_equals(getComputedStyle(document.querySelector("div[hidden]")).display, "none");
     36 }, `div[hidden] element should be hidden`);
     37 
     38 test(function() {
     39  const el = document.querySelector("embed[hidden='']");
     40  assert_equals(getComputedStyle(el).display, "inline");
     41  assert_equals(getComputedStyle(el).width, "0px");
     42  assert_equals(getComputedStyle(el).height, "0px");
     43 }, `embed[hidden=''] element should be inline 0x0`);
     44 
     45 test(function() {
     46  const el = document.querySelector("embed[hidden='until-found']");
     47  assert_equals(getComputedStyle(el).display, "inline");
     48  assert_equals(getComputedStyle(el).width, "0px");
     49  assert_equals(getComputedStyle(el).height, "0px");
     50  assert_equals(getComputedStyle(el).contentVisibility, "visible");
     51 }, `embed[hidden='until-found'] element should be inline 0x0`);
     52 </script>