Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<title>Changing classList updates result of Element.matches()</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<!-- regression test for https://github.com/jsdom/jsdom/issues/3948 -->
<script>
"use strict";
test(() => {
const div = document.createElement("div");
assert_equals(div.matches(".foo"), false, "initial");
div.classList.add("foo");
assert_equals(div.matches(".foo"), true, "class added");
div.classList.remove("foo");
assert_equals(div.matches(".foo"), false, "class removed");
}, "toggle class sync");
</script>