| <!doctype html> |
| <html> |
| <head> |
| <script src="../../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <undefined id="undefined1"> |
| <null id="null1"> |
| <target id="target1"></target> |
| </null> |
| </undefined> |
| |
| <null id="null2"> |
| <target id="target2"></target> |
| </null> |
| |
| <undefined id="undefined3"> |
| <target id="target3"></target> |
| </undefined> |
| |
| <foo> |
| <bar> |
| <target id="target4"></target> |
| <bar> |
| </foo> |
| |
| </body> |
| <script> |
| description('Test Element.closest() with no argument, null, and undefined.'); |
| |
| shouldThrow('document.getElementById("target1").closest()', '"TypeError: Not enough arguments"'); |
| shouldBeEqualToString('document.getElementById("target1").closest(null).id', 'null1'); |
| shouldBeEqualToString('document.getElementById("target1").closest(undefined).id', 'undefined1'); |
| |
| shouldThrow('document.getElementById("target2").closest()', '"TypeError: Not enough arguments"'); |
| shouldBeEqualToString('document.getElementById("target2").closest(null).id', 'null2'); |
| shouldBeNull('document.getElementById("target2").closest(undefined)'); |
| |
| shouldThrow('document.getElementById("target3").closest()', '"TypeError: Not enough arguments"'); |
| shouldBeNull('document.getElementById("target3").closest(null)'); |
| shouldBeEqualToString('document.getElementById("target3").closest(undefined).id', 'undefined3'); |
| |
| shouldThrow('document.getElementById("target4").closest()', '"TypeError: Not enough arguments"'); |
| shouldBeNull('document.getElementById("target4").closest(null)'); |
| shouldBeNull('document.getElementById("target4").closest(undefined)'); |
| </script> |
| <script src="../../../resources/js-test-post.js"></script> |
| </html> |