diff options
Diffstat (limited to 'testing/web-platform/tests/dom/nodes/ParentNode-querySelectors-exclusive.html')
-rw-r--r-- | testing/web-platform/tests/dom/nodes/ParentNode-querySelectors-exclusive.html | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/nodes/ParentNode-querySelectors-exclusive.html b/testing/web-platform/tests/dom/nodes/ParentNode-querySelectors-exclusive.html new file mode 100644 index 0000000000..5cff9367cf --- /dev/null +++ b/testing/web-platform/tests/dom/nodes/ParentNode-querySelectors-exclusive.html @@ -0,0 +1,39 @@ +<!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> |