Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: capricorn86/happy-dom
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v10.6.3
Choose a base ref
...
head repository: capricorn86/happy-dom
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v10.7.0
Choose a head ref
  • 2 commits
  • 3 files changed
  • 2 contributors

Commits on Aug 2, 2023

  1. Copy the full SHA
    b99d0c2 View commit details

Commits on Aug 3, 2023

  1. Merge pull request #991 from lukaselmer/master

    Add naive scrollHeight implementation
    capricorn86 authored Aug 3, 2023
    Copy the full SHA
    9221b75 View commit details
2 changes: 2 additions & 0 deletions packages/happy-dom/src/nodes/element/Element.ts
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ export default class Element extends Node implements IElement {
public shadowRoot: IShadowRoot = null;
public prefix: string = null;

public scrollHeight = 0;
public scrollTop = 0;
public scrollLeft = 0;
public children: IHTMLCollection<IElement> = new HTMLCollection<IElement>();
@@ -369,6 +370,7 @@ export default class Element extends Node implements IElement {
(<string>clone.tagName) = this.tagName;
clone.scrollLeft = this.scrollLeft;
clone.scrollTop = this.scrollTop;
clone.scrollHeight = this.scrollHeight;
(<string>clone.namespaceURI) = this.namespaceURI;

return <IElement>clone;
1 change: 1 addition & 0 deletions packages/happy-dom/src/nodes/element/IElement.ts
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ export default interface IElement extends IChildNode, INonDocumentTypeChildNode,
prefix: string | null;
scrollTop: number;
scrollLeft: number;
scrollHeight: number;
id: string;
className: string;
role: string;
6 changes: 6 additions & 0 deletions packages/happy-dom/test/nodes/element/Element.test.ts
Original file line number Diff line number Diff line change
@@ -1512,6 +1512,12 @@ describe('Element', () => {
});
}

describe('scrollHeight', () => {
it('Returns the scroll height.', () => {
expect(element.scrollHeight).toBe(0);
});
});

describe('toString()', () => {
it('Returns the same as outerHTML.', () => {
expect(element.toString()).toBe(element.outerHTML);