tor-browser

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

htmlanchorelement_getter.html (1659B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <html>
      4 <head>
      5 <title>HTMLAnchorElement getters test</title>
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <a id=a1 href="http://google.com?hi">a1</a>
      9 <a id=a2 href="http://google.com#somehash">a2</a>
     10 <a id=a3 href="http://google.com:1234/somedir">a3</a>
     11 <a id=a4 href="http://google.com:1234/somedir">a4</a>
     12 <a id=a5 href="http://google.com:1234/somedir">a5</a>
     13 <a id=a6 href="https://anonymous:flabada@developer.mozilla.org/en-US/docs/">a6</a>
     14 <a id=a7 href="http://google.com:1234/somedir/someotherdir/index.html">a7</a>
     15 <a id=a8 href="http://google.com:1234/somedir">a8</a>
     16 <a id=a9 href="http://google.com/somedir">a9</a>
     17 <a id=a10 href="https://anonymous:pwd@developer.mozilla.org:1234/en-US/">a10</a>
     18 <script>
     19 function test_getter(property, result, id) {
     20  var a = document.getElementById(id);
     21  var r = a[property];
     22  assert_equals(r, result);
     23 }
     24 
     25 //Elements for each test: [property, result, id]
     26 //                         [0]       [1]     [2]
     27 tests = [
     28  ["search", "?hi", "a1"],
     29  ["hash", "#somehash", "a2"],
     30  ["host", "google.com:1234", "a3"],
     31  ["hostname", "google.com", "a4"],
     32  ["href", "http://google.com:1234/somedir", "a5"],
     33  ["password", "flabada", "a6"],
     34  ["pathname", "/somedir/someotherdir/index.html", "a7"],
     35  ["port", "1234",  "a8"],
     36  ["protocol", "http:", "a9"],
     37  ["username", "anonymous", "a10"]
     38 ];
     39 
     40 for (var i = 0; i < tests.length; i++) {
     41    test(function() {
     42        test_getter(tests[i][0], tests[i][1], tests[i][2])
     43    }, "Getter for attribute of anchor element(" + i + "):" + tests[i][0]);
     44 }
     45 </script>
     46 </head>
     47 </html>