OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <meta charset=utf-8> |
| 3 <title>Document.createTreeWalker</title> |
| 4 <script src=../../../../resources/testharness.js></script> |
| 5 <script src=../../../../resources/testharnessreport.js></script> |
| 6 <div id=log></div> |
| 7 <script> |
| 8 test(function() { |
| 9 assert_throws(new TypeError(), function() { |
| 10 document.createTreeWalker(); |
| 11 }); |
| 12 }, "Required arguments to createTreeWalker should be required."); |
| 13 test(function() { |
| 14 var tw = document.createTreeWalker(document.body); |
| 15 assert_equals(tw.root, document.body); |
| 16 assert_equals(tw.currentNode, document.body); |
| 17 assert_equals(tw.whatToShow, 0xFFFFFFFF); |
| 18 assert_equals(tw.filter, null); |
| 19 }, "Optional arguments to createTreeWalker should be optional (1 passed)."); |
| 20 test(function() { |
| 21 var tw = document.createTreeWalker(document.body, 42); |
| 22 assert_equals(tw.root, document.body); |
| 23 assert_equals(tw.currentNode, document.body); |
| 24 assert_equals(tw.whatToShow, 42); |
| 25 assert_equals(tw.filter, null); |
| 26 }, "Optional arguments to createTreeWalker should be optional (2 passed)."); |
| 27 test(function() { |
| 28 var tw = document.createTreeWalker(document.body, 42, null); |
| 29 assert_equals(tw.root, document.body); |
| 30 assert_equals(tw.currentNode, document.body); |
| 31 assert_equals(tw.whatToShow, 42); |
| 32 assert_equals(tw.filter, null); |
| 33 }, "Optional arguments to createTreeWalker should be optional (3 passed, null)."
); |
| 34 test(function() { |
| 35 var fn = function() {}; |
| 36 var tw = document.createTreeWalker(document.body, 42, fn); |
| 37 assert_equals(tw.root, document.body); |
| 38 assert_equals(tw.currentNode, document.body); |
| 39 assert_equals(tw.whatToShow, 42); |
| 40 assert_equals(tw.filter, fn); |
| 41 }, "Optional arguments to createTreeWalker should be optional (3 passed, functio
n)."); |
| 42 </script> |
OLD | NEW |