Skip to content

Commit

Permalink
#840@patch: Fixes an issue where number values in name and id attribu…
Browse files Browse the repository at this point in the history
…tes caused a collision with index properties in HTMLCollection.
  • Loading branch information
capricorn86 committed Apr 7, 2023
1 parent fa2d574 commit 057c9a4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/happy-dom/test/nodes/element/HTMLCollection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,15 @@ describe('HTMLCollection', () => {
expect(document.body.children.namedItem('div3') === null).toBe(true);
expect(document.body.children.namedItem('div5') === div5).toBe(true);
});

it('Supports attributes only consisting of numbers.', () => {
const div = document.createElement('div');
div.innerHTML = `<div name="1" class="container"></div>`;
const container = div.children[0];
expect(div.children.length).toBe(1);
expect(div.children[0]).toBe(container.children[0]);
expect(div.children[1]).toBe(undefined);
expect(div.children.namedItem('1')).toBe(container.children[0]);
});
});
});

0 comments on commit 057c9a4

Please sign in to comment.