<!doctype html>
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<undefined></undefined>
<null></null>
<defined></defined>
</body>
<script>
description('Test Element.matches() with no argument, null, and undefined.');

shouldThrow('document.getElementsByTagName("undefined")[0].matches()', '"TypeError: Not enough arguments"');
shouldBeTrue('document.getElementsByTagName("undefined")[0].matches(undefined)');
shouldBeFalse('document.getElementsByTagName("undefined")[0].matches(null)');

shouldThrow('document.getElementsByTagName("null")[0].matches()', '"TypeError: Not enough arguments"');
shouldBeTrue('document.getElementsByTagName("null")[0].matches(null)');
shouldBeFalse('document.getElementsByTagName("null")[0].matches(undefined)');

shouldThrow('document.getElementsByTagName("defined")[0].matches()', '"TypeError: Not enough arguments"');
shouldBeFalse('document.getElementsByTagName("defined")[0].matches(null)');
shouldBeFalse('document.getElementsByTagName("defined")[0].matches(undefined)');

shouldThrow('document.getElementsByTagName("undefined")[0].webkitMatchesSelector()', '"TypeError: Not enough arguments"');
shouldBeTrue('document.getElementsByTagName("undefined")[0].webkitMatchesSelector(undefined)');
shouldBeFalse('document.getElementsByTagName("undefined")[0].webkitMatchesSelector(null)');

shouldThrow('document.getElementsByTagName("null")[0].webkitMatchesSelector()', '"TypeError: Not enough arguments"');
shouldBeTrue('document.getElementsByTagName("null")[0].webkitMatchesSelector(null)');
shouldBeFalse('document.getElementsByTagName("null")[0].webkitMatchesSelector(undefined)');

shouldThrow('document.getElementsByTagName("defined")[0].webkitMatchesSelector()', '"TypeError: Not enough arguments"');
shouldBeFalse('document.getElementsByTagName("defined")[0].webkitMatchesSelector(null)');
shouldBeFalse('document.getElementsByTagName("defined")[0].webkitMatchesSelector(undefined)');
</script>
<script src="../../../resources/js-test-post.js"></script>
</html>
