Closed alonidiom closed 10 months ago
I'm willing to help out further if needed. Perhaps add some missing test cases?
I couldn't' really wrap my head around how testing works here, but my PR for JSDOM includes a test that fails before the fix, and passes after it:
<style>
.test-1, .test-2 {
color: rgb(255, 0, 0);
}
/* ... */
.test-2:has(span) {
color: rgb(0, 255, 0);
}
</style>
<div class="test-2">
<p id="p2">test</p>
</div>
<script>
"use strict";
// ...
test(() => {
const element = document.getElementById("p2");
assert_equals(getComputedStyle(element).color, "rgb(255, 0, 0)");
element.appendChild(document.createElement("span"));
assert_equals(getComputedStyle(element).color, "rgb(0, 255, 0)");
}, "Adding a span should change the text color to green");
</script>
@dperini, is there anything that's holding this PR back?
@alonidiom thank you for the contribution of the :has selector fix.
Fixes https://github.com/jsdom/jsdom/pull/3609