OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>NodeIterator: Basic test</title> | 4 <title>NodeIterator: Basic test</title> |
5 <script src="../../../resources/testharness.js"></script> | 5 <script src="../../../resources/testharness.js"></script> |
6 <script src="../../../resources/testharnessreport.js"></script> | 6 <script src="../../../resources/testharnessreport.js"></script> |
7 <link rel="stylesheet" href="../../../resources/testharness.css"> | 7 <link rel="stylesheet" href="../../../resources/testharness.css"> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <p>This test checks the basic functionality of NodeIterator.</p> | 10 <p>This test checks the basic functionality of NodeIterator.</p> |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 node.nodeType === Node.TEXT_NODE && node.nodeValue === 'e' || | 186 node.nodeType === Node.TEXT_NODE && node.nodeValue === 'e' || |
187 node.nodeType === Node.COMMENT_NODE && node.nodeValue === 'j') { | 187 node.nodeType === Node.COMMENT_NODE && node.nodeValue === 'j') { |
188 return NodeFilter.FILTER_ACCEPT; | 188 return NodeFilter.FILTER_ACCEPT; |
189 } | 189 } |
190 return NodeFilter.FILTER_REJECT; | 190 return NodeFilter.FILTER_REJECT; |
191 }; | 191 }; |
192 var iterator = document.createNodeIterator(createSampleDOM(), NodeFilter.SHO
W_ALL, filter); | 192 var iterator = document.createNodeIterator(createSampleDOM(), NodeFilter.SHO
W_ALL, filter); |
193 testIteratorForwardAndBackward(iterator, expected); | 193 testIteratorForwardAndBackward(iterator, expected); |
194 }, 'Test the behavior of NodeIterator when NodeFilter is specified.'); | 194 }, 'Test the behavior of NodeIterator when NodeFilter is specified.'); |
195 | 195 |
196 test(function () | |
197 { | |
198 var filter = function (node) { | |
199 return NodeFilter.FILTER_ACCEPT; | |
200 }; | |
201 [true, false].forEach(function (expandEntityReferences) { | |
202 var iterator = document.createNodeIterator(createSampleDOM(), NodeFilter
.SHOW_ALL, filter, expandEntityReferences); | |
203 assert_true(iterator instanceof NodeIterator); | |
204 assert_false(iterator.expandEntityReferences); | |
205 testIteratorForwardAndBackward(iterator, expectedAll); | |
206 }); | |
207 }, 'Test that the fourth argument (expandEntityReferences) is ignored.'); | |
208 | |
209 test(function() { | 196 test(function() { |
210 var nodeIterator = document.createNodeIterator(document.body, 42, null); | 197 var nodeIterator = document.createNodeIterator(document.body, 42, null); |
211 assert_equals(nodeIterator.root, document.body); | 198 assert_equals(nodeIterator.root, document.body); |
212 assert_equals(nodeIterator.referenceNode, document.body); | 199 assert_equals(nodeIterator.referenceNode, document.body); |
213 assert_equals(nodeIterator.whatToShow, 42); | 200 assert_equals(nodeIterator.whatToShow, 42); |
214 assert_equals(nodeIterator.filter, null); | 201 assert_equals(nodeIterator.filter, null); |
215 }, "Optional arguments to createNodeIterator should be optional (3 passed, null)
."); | 202 }, "Optional arguments to createNodeIterator should be optional (3 passed, null)
."); |
216 </script> | 203 </script> |
217 </body> | 204 </body> |
218 </html> | 205 </html> |
OLD | NEW |