tor-browser

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

multi-match.html (1099B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Named access on the window object - Multiple matches</title>
      4 <link rel="author" title="Matthew Phillips" href="mailto:matthew@matthewphillips.info">
      5 <link rel="help" href="https://html.spec.whatwg.org/#named-access-on-the-window-object">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 
      9 <body>
     10 <script>
     11 "use strict";
     12 
     13 test(() => {
     14  const img1 = document.createElement("img");
     15  img1.setAttribute("name", "foo");
     16  document.body.appendChild(img1);
     17 
     18  const img0 = document.createElement("img");
     19  img0.setAttribute("name", "foo");
     20  document.body.insertBefore(img0, img1);
     21 
     22  const div = document.createElement("div");
     23  div.setAttribute("id", "foo");
     24  document.body.appendChild(div);
     25 
     26  assert_true(window.foo instanceof window.HTMLCollection);
     27  assert_equals(window.foo.length, 3);
     28  assert_true(window.foo[0] === img0);
     29  assert_true(window.foo[1] === img1);
     30  assert_true(window.foo[2] === div);
     31 }, "A named property must return a HTMLCollection if there are multiple matches");
     32 </script>