Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset="utf-8">
<title>querySelector/querySelectorAll should not include their thisArg</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- Regression test for https://github.com/jsdom/jsdom/issues/2296 -->
<script>
"use strict";
setup({ single_test: true });
const button = document.createElement("button");
assert_equals(button.querySelector("*"), null, "querySelector, '*', before modification");
assert_equals(button.querySelector("button"), null, "querySelector, 'button', before modification");
assert_equals(button.querySelector("button, span"), null, "querySelector, 'button, span', before modification");
assert_array_equals(button.querySelectorAll("*"), [], "querySelectorAll, '*', before modification");
assert_array_equals(button.querySelectorAll("button"), [], "querySelectorAll, 'button', before modification");
assert_array_equals(
button.querySelectorAll("button, span"), [],
"querySelectorAll, 'button, span', before modification"
);
button.innerHTML = "text";
assert_equals(button.querySelector("*"), null, "querySelector, '*', after modification");
assert_equals(button.querySelector("button"), null, "querySelector, 'button', after modification");
assert_equals(button.querySelector("button, span"), null, "querySelector, 'button, span', after modification");
assert_array_equals(button.querySelectorAll("*"), [], "querySelectorAll, '*', after modification");
assert_array_equals(button.querySelectorAll("button"), [], "querySelectorAll, 'button', after modification");
assert_array_equals(
button.querySelectorAll("button, span"), [],
"querySelectorAll, 'button, span', after modification"
);
done();
</script>