chromium/third_party/blink/web_tests/fast/dom/SelectorAPI/undefined-null-stringify.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>This tests that the querySelector, querySelectorAll and matchesSelector (webkitMatchesSelector) correctly stringify null and undefined to "null" and "undefined".</title>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
</head>
<body>
<script>
setup({ single_test: true });

var root = document.createElement('div');
var nullNode = document.createElement('null');
root.appendChild(nullNode);
var undefinedNode = document.createElement('undefined');
root.appendChild(undefinedNode);
document.body.appendChild(root);

assert_equals(document.querySelector(null), nullNode);
assert_equals(document.querySelector(undefined), undefinedNode);

assert_equals(document.querySelectorAll(null).length, 1);
assert_equals(document.querySelectorAll(null).item(0), nullNode);
assert_equals(document.querySelectorAll(undefined).length, 1);
assert_equals(document.querySelectorAll(undefined).item(0), undefinedNode);

assert_true(nullNode.webkitMatchesSelector(null));
assert_true(undefinedNode.webkitMatchesSelector(undefined));
done();
</script>
</body>
</html>