| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> | 2 <meta charset="utf-8"> |
| 3 <title>Node.prototype.isSameNode</title> | 3 <title>Node.prototype.isSameNode</title> |
| 4 <link rel=help href="https://dom.spec.whatwg.org/#dom-node-issamenode"> | 4 <link rel=help href="https://dom.spec.whatwg.org/#dom-node-issamenode"> |
| 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 <script> | 7 <script> |
| 8 "use strict"; | 8 "use strict"; |
| 9 | 9 |
| 10 test(function() { | 10 test(function() { |
| 11 | 11 |
| 12 var doctype1 = document.implementation.createDocumentType("qualifiedName", "pu
blicId", "systemId"); | 12 var doctype1 = document.implementation.createDocumentType("qualifiedName", "pu
blicId", "systemId"); |
| 13 var doctype2 = document.implementation.createDocumentType("qualifiedName", "pu
blicId", "systemId"); | 13 var doctype2 = document.implementation.createDocumentType("qualifiedName", "pu
blicId", "systemId"); |
| 14 | 14 |
| 15 assert_true(doctype1.isSameNode(doctype1), "self-comparison"); | 15 assert_true(doctype1.isSameNode(doctype1), "self-comparison"); |
| 16 assert_false(doctype1.isSameNode(doctype2), "same properties"); | 16 assert_false(doctype1.isSameNode(doctype2), "same properties"); |
| 17 assert_false(doctype1.isSameNode(null), "with null other node"); | 17 assert_false(doctype1.isSameNode(null), "with null other node"); |
| 18 }, "doctypes should be comapred on reference"); | 18 }, "doctypes should be comapred on reference"); |
| 19 | 19 |
| 20 test(function() { | 20 test(function() { |
| 21 | 21 |
| 22 var element1 = document.createElementNS("namespace", "prefix:localName"); | 22 var element1 = document.createElementNS("namespace", "prefix:localName"); |
| 23 var element2 = document.createElementNS("namespace", "prefix:localName"); | 23 var element2 = document.createElementNS("namespace", "prefix:localName"); |
| 24 | 24 |
| 25 assert_true(element1.isSameNode(element1), "self-comparison"); | 25 assert_true(element1.isSameNode(element1), "self-comparison"); |
| 26 assert_false(element1.isSameNode(element2), "same properties"); | 26 assert_false(element1.isSameNode(element2), "same properties"); |
| 27 assert_false(element1.isSameNode(null), "with null other node"); | 27 assert_false(element1.isSameNode(null), "with null other node"); |
| 28 | 28 |
| 29 }, "elements should be compared on reference"); | 29 }, "elements should be compared on reference (namespaced element)"); |
| 30 | 30 |
| 31 test(function() { | 31 test(function() { |
| 32 | 32 |
| 33 var element1 = document.createElement("element"); | 33 var element1 = document.createElement("element"); |
| 34 element1.setAttributeNS("namespace", "prefix:localName", "value"); | 34 element1.setAttributeNS("namespace", "prefix:localName", "value"); |
| 35 | 35 |
| 36 var element2 = document.createElement("element"); | 36 var element2 = document.createElement("element"); |
| 37 element2.setAttributeNS("namespace", "prefix:localName", "value"); | 37 element2.setAttributeNS("namespace", "prefix:localName", "value"); |
| 38 | 38 |
| 39 assert_true(element1.isSameNode(element1), "self-comparison"); | 39 assert_true(element1.isSameNode(element1), "self-comparison"); |
| 40 assert_false(element1.isSameNode(element2), "same properties"); | 40 assert_false(element1.isSameNode(element2), "same properties"); |
| 41 assert_false(element1.isSameNode(null), "with null other node"); | 41 assert_false(element1.isSameNode(null), "with null other node"); |
| 42 | 42 |
| 43 }, "elements should be compared on reference"); | 43 }, "elements should be compared on reference (namespaced attribute)"); |
| 44 | 44 |
| 45 test(function() { | 45 test(function() { |
| 46 | 46 |
| 47 var pi1 = document.createProcessingInstruction("target", "data"); | 47 var pi1 = document.createProcessingInstruction("target", "data"); |
| 48 var pi2 = document.createProcessingInstruction("target", "data"); | 48 var pi2 = document.createProcessingInstruction("target", "data"); |
| 49 | 49 |
| 50 assert_true(pi1.isSameNode(pi1), "self-comparison"); | 50 assert_true(pi1.isSameNode(pi1), "self-comparison"); |
| 51 assert_false(pi1.isSameNode(pi2), "different target"); | 51 assert_false(pi1.isSameNode(pi2), "different target"); |
| 52 assert_false(pi1.isSameNode(null), "with null other node"); | 52 assert_false(pi1.isSameNode(null), "with null other node"); |
| 53 | 53 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 var document1 = document.implementation.createDocument("", ""); | 91 var document1 = document.implementation.createDocument("", ""); |
| 92 var document2 = document.implementation.createDocument("", ""); | 92 var document2 = document.implementation.createDocument("", ""); |
| 93 | 93 |
| 94 assert_true(document1.isSameNode(document1), "self-comparison"); | 94 assert_true(document1.isSameNode(document1), "self-comparison"); |
| 95 assert_false(document1.isSameNode(document2), "another empty XML document"); | 95 assert_false(document1.isSameNode(document2), "another empty XML document"); |
| 96 assert_false(document1.isSameNode(null), "with null other node"); | 96 assert_false(document1.isSameNode(null), "with null other node"); |
| 97 | 97 |
| 98 }, "documents should not be compared on reference"); | 98 }, "documents should not be compared on reference"); |
| 99 | 99 |
| 100 </script> | 100 </script> |
| OLD | NEW |