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

Selector [attr^=value] without quotes not working with the latest version #923

Closed
ypconstante opened this issue May 15, 2023 · 1 comment · Fixed by #926
Closed

Selector [attr^=value] without quotes not working with the latest version #923

ypconstante opened this issue May 15, 2023 · 1 comment · Fixed by #926
Assignees
Labels
bug Something isn't working

Comments

@ypconstante
Copy link

ypconstante commented May 15, 2023

Describe the bug

On happy-dom 9.18.3, the selector [attr^=value] is not working when the value is not wrapped by quotes. This worked on previous versions.

To Reproduce

const { Window } = require("happy-dom")

const window = new Window();
const document = window.document;

document.body.innerHTML = '<div id="my-container"></div>';

console.log(document.querySelector('[id^="my"]') != null);
console.log(document.querySelector("[id^='my']") != null);
console.log(document.querySelector("[id^=my]") != null);

Output:

true // [id^="my"]
true // [id^='my']
false // [id^=my]

Expected behavior

Output with version 9.16.0

true // [id^="my"]
true // [id^='my']
true // [id^=my]

Device:

  • OS: macOS 13.3.1
  • Browser -
  • Version -
@ypconstante ypconstante added the bug Something isn't working label May 15, 2023
@capricorn86 capricorn86 self-assigned this May 18, 2023
capricorn86 added a commit that referenced this issue May 18, 2023
…d with a value without quatation marks no longer worked (e.g. "[attr^=value]").
capricorn86 added a commit that referenced this issue May 18, 2023
…-without-quotes-not-working-with-the-latest-version

#923@patch: Fixes issue where attribute selectors with an operator an…
@capricorn86
Copy link
Owner

Thank you for reporting @ypconstante! 🙂

There is a fix released now.

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

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