tor-browser

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

test_bug698384.html (2170B)


      1 <!DOCTYPE HTML>
      2 <html>
      3  <!--
      4    https://bugzilla.mozilla.org/show_bug.cgi?id=698384
      5  -->
      6  <head>
      7    <title>Test for Bug 698384</title>
      8    <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9    <script src="/tests/SimpleTest/EventUtils.js"
     10      type="text/javascript"></script>
     11    <link rel="stylesheet" type="text/css"
     12      href="/tests/SimpleTest/test.css" />
     13  </head>
     14  <body onload="runTests();">
     15    <a target="_blank"
     16      href="https://bugzilla.mozilla.org/show_bug.cgi?id=698384">
     17      Mozilla Bug 698384</a>
     18    <p id="display"></p>
     19    <div id="content" style="display: none"></div>
     20    <pre id="test">
     21      <script type="text/javascript">
     22        /*
     23          Checks to see if default parameter handling is correct when 0, 1
     24          or 2 parameters are passed.
     25 
     26          If one is only passed, aFilter should default to null
     27          If none are passed, aFilter should be null and aWhatToShow should
     28          be NodeFilter.SHOW_ALL
     29        */
     30        SimpleTest.waitForExplicitFinish();
     31 
     32        var content = $('content'),
     33            ni;
     34 
     35        content.innerHTML = ('<span id="A"><\/span><span id="B"><\/span>'
     36          + '<span id="C"><\/span>');
     37 
     38        function runTests() {
     39 
     40          // Test NodeIterator when no optional arguments are given
     41          ni = document.createNodeIterator(content);
     42          is(ni.whatToShow, NodeFilter.SHOW_ALL, "whatToShow should be " +
     43            "NodeFilter.SHOW_ALL when both " +
     44            " optionals are not given");
     45          is(ni.filter, null, "filter should be defaulted to null when both " +
     46            " optionals are not given");
     47 
     48          // Test NodeIterator when first optional is passed
     49          ni = document.createNodeIterator(content, NodeFilter.SHOW_ELEMENT);
     50          is(ni.filter, null, "filter should be defaulted to null when only " +
     51            " first argument is passed");
     52          is(ni.whatToShow, NodeFilter.SHOW_ELEMENT, "whatToShow should " +
     53            "properly be set to NodeFilter.SHOW_ELEMENT when whatToShow is " +
     54            "provided and filter is not");
     55 
     56          SimpleTest.finish();
     57        }
     58      </script>
     59    </pre>
     60  </body>
     61 </html>