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

QuerySelector : infinite loop when there is no number before n #686

Closed
takaya1992 opened this issue Jan 5, 2023 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@takaya1992
Copy link
Contributor

Describe the bug

infinite loop when there is no number before n on nth-child

for example: :nth-cihld(n+2)

To Reproduce

window = new Window();
document = window.document;
const container = document.createElement('div');
container.innerHTML = `
  <div>
    <span>a</span>
    <span>b</span>
    <span>c</span>
  </div>
`;
const elements = container.querySelectorAll(':nth-child(n+2)'); // inifinite loop
// Expected : [ '<span>b</span>', '<span>c</span>' ]

Expected behavior

return the expected value without going into an infinite loop

@takaya1992 takaya1992 added the bug Something isn't working label Jan 5, 2023
takaya1992 added a commit to takaya1992/happy-dom that referenced this issue Jan 5, 2023
takaya1992 added a commit to takaya1992/happy-dom that referenced this issue Jan 5, 2023
capricorn86 added a commit that referenced this issue Jan 5, 2023
…r-n-infinite-loop

#686@patch: Bugfix query selector n infinite loop.
@capricorn86
Copy link
Owner

Thank you for your contribution @takaya1992! 🙂

You can read more about the release here:
https://github.com/capricorn86/happy-dom/releases/tag/v8.1.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

No branches or pull requests

2 participants