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

Assigned keys to HTMLElement.dataset are ignored #405

Closed
tobiasdalhof opened this issue Mar 15, 2022 · 0 comments · Fixed by #438
Closed

Assigned keys to HTMLElement.dataset are ignored #405

tobiasdalhof opened this issue Mar 15, 2022 · 0 comments · Fixed by #438
Assignees
Labels
bug Something isn't working

Comments

@tobiasdalhof
Copy link

tobiasdalhof commented Mar 15, 2022

Hey there,

I stumbled upon an issue where assigned keys to HTMLElement.dataset are ignored.

To reproduce the issue, you can extend this test case:

describe('get dataset()', () => {
	it('Returns attributes prefixed with "data-" as an object.', () => {
		element.setAttribute('test1', 'value1');
		element.setAttribute('data-test2', 'value2');
		element.setAttribute('test3', 'value3');
		element.setAttribute('data-test4', 'value4');
		element.dataset.test5 = 'value5'; // Add this line
		expect(element.dataset).toEqual({
			test2: 'value2',
			test4: 'value4',
			test5: 'value5' // Add this line
		});
	});
});
@capricorn86 capricorn86 added the bug Something isn't working label Mar 15, 2022
@capricorn86 capricorn86 self-assigned this Mar 30, 2022
capricorn86 pushed a commit that referenced this issue Mar 31, 2022
…lement.dataset object. The changes will be reflected to the attributes of the element. Fixes issue with dataset keys not being in lower camel case. Improves performance of HTMLElement.getAttributeNS() which is used in many places within Happy DOM.
@capricorn86 capricorn86 linked a pull request Mar 31, 2022 that will close this issue
capricorn86 pushed a commit that referenced this issue Mar 31, 2022
…tag name to Document.createElement() and Document.createElementNS().
capricorn86 added a commit that referenced this issue Mar 31, 2022
…mlelementdataset-are-ignored

#405@patch: Adds support for sending in other values than strings as …
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