tor-browser

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

document.getElementsByName-null-undef-xhtml.xhtml (1212B)


      1 <html xmlns="http://www.w3.org/1999/xhtml">
      2 <head>
      3 <title>Calling getElementsByName with null and undefined</title>
      4 <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"/>
      5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-getelementsbyname"/>
      6 <link rel="help" href="https://webidl.spec.whatwg.org/#es-DOMString"/>
      7 <link rel="help" href="http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf#page=57"/>
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 </head>
     11 <body>
     12 <div id="log"></div>
     13 <script>
     14 test(function() {
     15  var n = document.createElement("div");
     16  n.setAttribute("name", "null");
     17 
     18  document.body.appendChild(n);
     19  this.add_cleanup(function() { document.body.removeChild(n) });
     20 
     21  assert_equals(document.getElementsByName(null)[0], n);
     22 }, "getElementsByName(null)");
     23 
     24 test(function() {
     25  var u = document.createElement("div");
     26  u.setAttribute("name", "undefined");
     27 
     28  document.body.appendChild(u);
     29  this.add_cleanup(function() { document.body.removeChild(u) });
     30 
     31  assert_equals(document.getElementsByName(undefined)[0], u);
     32 }, "getElementsByName(undefined)");
     33 </script>
     34 </body>
     35 </html>