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