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

Option element: Missing value fallback implementation #648

Closed
itutto opened this issue Nov 7, 2022 · 1 comment
Closed

Option element: Missing value fallback implementation #648

itutto opened this issue Nov 7, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@itutto
Copy link
Contributor

itutto commented Nov 7, 2022

Describe the bug
An <option> element's interface should return the textContent as fallback if no value attribute is present.

The current implementation returns an empty string in such cases.

return this.getAttributeNS(null, 'value') || '';

To Reproduce

The DOM content: <option id=test>Fallback value</option>
Expectation: expect(test.value === 'Fallback value'); // test.value will return ''

Expected behavior
This request is based on the specification:
https://html.spec.whatwg.org/multipage/form-elements.html#the-option-element

The value attribute provides a value for element. The value of an option element is the value of the value content attribute, if there is one, or, if there is not, the value of the element's text IDL attribute.

Screenshots
n.a.

Device:
any

Additional context
Fix proposal is ready, I created this Issue for getting a taskId :)

@itutto itutto added the bug Something isn't working label Nov 7, 2022
itutto added a commit to itutto/happy-dom that referenced this issue Nov 7, 2022
capricorn86 added a commit that referenced this issue Nov 8, 2022
#648@patch: OptionElement.value returns `textContent` as fallback.
@capricorn86
Copy link
Owner

Thank you for your contribution @itutto! 🙂

Your fix has been released.

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

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