tor-browser

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

test_nodelists.xhtml (1957B)


      1 <?xml version="1.0"?>
      2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
      3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
      4                 type="text/css"?>
      5 <window title="Test nodelists from chrome"
      6  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
      7  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
      8 
      9  <!-- test results are displayed in the html:body -->
     10  <body xmlns="http://www.w3.org/1999/xhtml">
     11  </body>
     12 
     13  <!-- test code goes here -->
     14  <script type="application/javascript"><![CDATA[
     15      SimpleTest.waitForExplicitFinish();
     16 
     17      function go() {
     18        var win = $('ifr').contentWindow;
     19        var list = win.document.getElementsByTagName('p');
     20        is(list.length, 3, "can get the length");
     21        ok(HTMLParagraphElement.isInstance(list[0]), "can get list[0]");
     22        is(list[0], list.item(0), "list.item works");
     23        is(list.item, list.item, "don't recreate functions for each get");
     24 
     25        var list2 = list[2];
     26        ok(HTMLParagraphElement.isInstance(list[2]), "list[2] exists");
     27        ok("2" in list, "in operator works");
     28 
     29        is(win.document.body.removeChild(win.document.body.lastChild), list2, "remove last paragraph element");
     30        ok(!("2" in list), "in operator doesn't see phantom element");
     31        is(list[2], undefined, "no node there!");
     32 
     33        var optionList = win.document.createElement("select").options;
     34        var option = win.document.createElement("option");
     35        optionList[0] = option;
     36        is(optionList.item(0), option, "Creators work");
     37 
     38        option = win.document.createElement("option");
     39        optionList[0] = option;
     40        is(optionList.item(0), option, "Setters work");
     41 
     42        SimpleTest.finish();
     43      }
     44  ]]></script>
     45 
     46  <iframe id="ifr"
     47          src="http://mochi.test:8888/tests/js/xpconnect/tests/mochitest/file_nodelists.html"
     48          onload="go()" />
     49 </window>