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

:not() pseudo class doesn't consider element type #753

Closed
romansp opened this issue Feb 14, 2023 · 1 comment · Fixed by #758
Closed

:not() pseudo class doesn't consider element type #753

romansp opened this issue Feb 14, 2023 · 1 comment · Fixed by #758
Labels
bug Something isn't working

Comments

@romansp
Copy link
Contributor

romansp commented Feb 14, 2023

Describe the bug
:not(element) selector doesn't consider provided element type when matching nodes.

To Reproduce
The following reproduction test is currently failing in happy-dom.

it('Returns all elements matching "[tabindex]:not(textarea)".', () => {
  document.body.innerHTML = `
    <div tabindex="-1"></div>
    <div tabindex="0"></div>
    <div tabindex="1"></div>
    <textarea tabindex="-1"></textarea>
  `;
  const elements = document.querySelectorAll('[tabindex]:not(textarea)');
  
  expect(elements.length).toBe(3);   // but actual is 0
});

Expected behavior
:not() pseudo class selector should properly match elements that do not match provided element type selector.

@romansp romansp added the bug Something isn't working label Feb 14, 2023
btea added a commit to btea/happy-dom that referenced this issue Feb 16, 2023
btea added a commit to btea/happy-dom that referenced this issue Feb 16, 2023
capricorn86 added a commit that referenced this issue Feb 16, 2023
@capricorn86
Copy link
Owner

Thanks for reporting @romansp! 🙂

Big thanks to @btea for contributing with a fix 🌟

The fix has been released.

You can read more about the release here:
https://github.com/capricorn86/happy-dom/releases/tag/v8.4.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants