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
querySelectorAll shoud respect document order #285
Comments
Hi @olace! 🙂 Sorry for taking such long time answering this. I will look into fixing this as soon as possible. |
I'm trying to use |
…e now in order of occurrence in the document.
Hi @olace and @kevinbarabash! 🙂 This has finally been fixed. You can read more about the release here: |
This still seems to be occurring using happy-dom 9.19.2, for example in Substack posts. When I run:
I get (compare the sixth and below lines output by happy-dom here, with what the browser outputs further below):
However, when I run it in the browser:
I get the following output:
For reference, jsdom outputs the correct result, so that's my workaround for now. |
@ariofrio I think I have identified the problem you experienced now. The sorting mechanism was sorting incorrectly as it sorted by characters and numbers came in the wrong order (1, 10, 11, 2, 3, 4 etc.). The unit test did not cover this. There is another fix in now. You can read more about the new release here: |
See #928 |
When using multiple selectors seprated by coma with querySelectorAll, the returned elements should be in document order as per the specifications.
For example, with the following HTML:
If I call document.querySelectorAll("h1,h2") happy-dom returns [1.0, 2.0, 1.1, 1.2, 2.1, 2.2] instead of the expected [1.0, 1.1, 1.2, 2.0, 2.1, 2.2]
The text was updated successfully, but these errors were encountered: