Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the :has selector test #98

Merged
merged 1 commit into from
Oct 23, 2023
Merged

Fix the :has selector test #98

merged 1 commit into from
Oct 23, 2023

Conversation

alonidiom
Copy link
Contributor

@blake-discover
Copy link

I'm willing to help out further if needed. Perhaps add some missing test cases?

@alonidiom
Copy link
Contributor Author

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>

@blake-discover
Copy link

@dperini, is there anything that's holding this PR back?

@dperini dperini merged commit cd912dc into dperini:master Oct 23, 2023
@dperini
Copy link
Owner

dperini commented Oct 24, 2023

@alonidiom
thank you for the contribution of the :has selector fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants