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

labels attribute misses labels without IDs #988

Closed
joshkel opened this issue Jul 13, 2023 · 1 comment · Fixed by #989
Closed

labels attribute misses labels without IDs #988

joshkel opened this issue Jul 13, 2023 · 1 comment · Fixed by #989
Labels
bug Something isn't working

Comments

@joshkel
Copy link
Contributor

joshkel commented Jul 13, 2023

Describe the bug

The labels attribute (for HTMLInputElement, HTMLSelectElement, etc.) is supposed to include enclosing labels, but it incorrectly only includes enclosing labels if the labelable element has an ID.

To Reproduce

<label>
This is a checkbox
<input type="checkbox" data-test-d="foo">
</label>

document.querySelector("[data-test-id='foo']").labels is empty.

Expected behavior

document.querySelector("[data-test-id='foo']").labels contains one label.

@joshkel joshkel added the bug Something isn't working label Jul 13, 2023
capricorn86 added a commit that referenced this issue Aug 2, 2023
#988@patch: Fix labels attribute with no IDs.
@capricorn86
Copy link
Owner

Your fix has been released @joshkel 🙂

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

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