| OLD | NEW |
| (Empty) |
| 1 <!doctype html> | |
| 2 <title>Node.contains() tests</title> | |
| 3 <link rel=author title="Aryeh Gregor" href=ayg@aryeh.name> | |
| 4 <div id=log></div> | |
| 5 <script src=../../../../resources/testharness.js></script> | |
| 6 <script src=../../../../resources/testharnessreport.js></script> | |
| 7 <script src=../common.js></script> | |
| 8 <script> | |
| 9 "use strict"; | |
| 10 | |
| 11 testNodes.forEach(function(referenceName) { | |
| 12 var reference = eval(referenceName); | |
| 13 | |
| 14 test(function() { | |
| 15 assert_false(reference.contains(null)); | |
| 16 }, referenceName + ".contains(null)"); | |
| 17 | |
| 18 testNodes.forEach(function(otherName) { | |
| 19 var other = eval(otherName); | |
| 20 test(function() { | |
| 21 var ancestor = other; | |
| 22 while (ancestor && ancestor !== reference) { | |
| 23 ancestor = ancestor.parentNode; | |
| 24 } | |
| 25 if (ancestor === reference) { | |
| 26 assert_true(reference.contains(other)); | |
| 27 } else { | |
| 28 assert_false(reference.contains(other)); | |
| 29 } | |
| 30 }, referenceName + ".compareDocumentPosition(" + otherName + ")"); | |
| 31 }); | |
| 32 }); | |
| 33 | |
| 34 testDiv.parentNode.removeChild(testDiv); | |
| 35 </script> | |
| 36 <!-- vim: set expandtab tabstop=2 shiftwidth=2: --> | |
| OLD | NEW |