Skip to content

Commit

Permalink
#1148@patch: Element.cloneNode() should not set scroll properties on …
Browse files Browse the repository at this point in the history
…the clone.
  • Loading branch information
capricorn86 committed Oct 27, 2023
1 parent 8ed0db0 commit 7b3ce5e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
4 changes: 0 additions & 4 deletions packages/happy-dom/src/nodes/element/Element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,6 @@ export default class Element extends Node implements IElement {
}

(<string>clone.tagName) = this.tagName;
clone.scrollLeft = this.scrollLeft;
clone.scrollTop = this.scrollTop;
clone.scrollWidth = this.scrollWidth;
clone.scrollHeight = this.scrollHeight;
(<string>clone.namespaceURI) = this.namespaceURI;

return <IElement>clone;
Expand Down
4 changes: 0 additions & 4 deletions packages/happy-dom/test/nodes/element/Element.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1551,8 +1551,6 @@ describe('Element', () => {
child.className = 'className';

(<string>element.tagName) = 'tagName';
(<number>element.scrollLeft) = 10;
(<number>element.scrollTop) = 10;

// @ts-ignore
element.namespaceURI = 'namespaceURI';
Expand All @@ -1562,8 +1560,6 @@ describe('Element', () => {
const clone = element.cloneNode(false);
const clone2 = element.cloneNode(true);
expect(clone.tagName).toBe('tagName');
expect(clone.scrollLeft).toBe(10);
expect(clone.scrollTop).toBe(10);
expect(clone.namespaceURI).toBe('namespaceURI');
expect(clone.children.length).toEqual(0);
expect(clone2.children.length).toBe(1);
Expand Down

0 comments on commit 7b3ce5e

Please sign in to comment.