Skip to content

Commit

Permalink
Merge pull request #1149 from capricorn86/task/1148-elementclonenode-…
Browse files Browse the repository at this point in the history
…should-not-set-scoll-properties-on-clone

#1148@patch: Element.cloneNode() should not set scroll properties on …
  • Loading branch information
capricorn86 authored Oct 27, 2023
2 parents 8ed0db0 + 7b3ce5e commit c404462
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 c404462

Please sign in to comment.