| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| |
| <script> |
| description('This test checks the behavior of DOM operations when called on non-DOM or incompatible receivers with non-DOM or incompatible arguments.'); |
| |
| function trySuspect(fun) { |
| try { |
| result = fun(); |
| return '' + result; |
| } catch (e) { |
| return 'threw ' + e; |
| } |
| } |
| |
| function check(a, b) { |
| return 1; |
| } |
| |
| var aDOMImplementation = document.implementation; |
| |
| var aSelect = document.createElement("select"); |
| var anOption = document.createElement("option"); |
| var aNode = document.createElement("div"); |
| var aSecondNode = document.createElement("div"); |
| aNode.appendChild(aSecondNode); |
| |
| shouldThrow("aNode.appendChild(aDOMImplementation)"); |
| |
| shouldThrow("aNode.appendChild('knort')"); |
| |
| shouldThrow("aNode.appendChild(void 0)"); |
| |
| shouldThrow("aNode.isSameNode(aDOMImplementation)"); |
| shouldThrow("aNode.isSameNode('foo')"); |
| shouldBeFalse("aNode.isSameNode(void 0)"); |
| shouldBe("aNode.lookupPrefix(aDOMImplementation)", "null"); |
| shouldBe("aNode.lookupPrefix(void 0)", "null"); |
| shouldBeTrue("aNode.cloneNode(aDOMImplementation) instanceof HTMLDivElement"); |
| shouldThrow("aSelect.add(aDOMImplementation, aDOMImplementation)"); |
| shouldThrow("aSelect.add(aDOMImplementation, anOption)"); |
| shouldBeUndefined("aSelect.add(anOption, aDOMImplementation)"); |
| shouldThrow("aSelect.add(void 0, void 0)"); |
| shouldThrow("aSelect.add(void 0, anOption)"); |
| shouldBeUndefined("aSelect.add(anOption, void 0)"); |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |
| |