From 9432d2c4192eefc8945634419557a7189b116bd1 Mon Sep 17 00:00:00 2001 From: konomae Date: Sat, 23 Sep 2023 19:17:21 +0900 Subject: [PATCH] #1089@minor: Add clientLeft and clientTop. --- packages/happy-dom/src/nodes/html-element/HTMLElement.ts | 2 ++ packages/happy-dom/src/nodes/html-element/IHTMLElement.ts | 2 ++ .../happy-dom/test/nodes/html-element/HTMLElement.test.ts | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/happy-dom/src/nodes/html-element/HTMLElement.ts b/packages/happy-dom/src/nodes/html-element/HTMLElement.ts index 218b58330..60e1f7b05 100644 --- a/packages/happy-dom/src/nodes/html-element/HTMLElement.ts +++ b/packages/happy-dom/src/nodes/html-element/HTMLElement.ts @@ -28,6 +28,8 @@ export default class HTMLElement extends Element implements IHTMLElement { public readonly offsetTop = 0; public readonly clientHeight = 0; public readonly clientWidth = 0; + public readonly clientLeft = 0; + public readonly clientTop = 0; public _style: CSSStyleDeclaration = null; private _dataset: Dataset = null; diff --git a/packages/happy-dom/src/nodes/html-element/IHTMLElement.ts b/packages/happy-dom/src/nodes/html-element/IHTMLElement.ts index a08372ebf..f341e351a 100644 --- a/packages/happy-dom/src/nodes/html-element/IHTMLElement.ts +++ b/packages/happy-dom/src/nodes/html-element/IHTMLElement.ts @@ -17,6 +17,8 @@ export default interface IHTMLElement extends IElement { offsetTop: number; clientHeight: number; clientWidth: number; + clientLeft: number; + clientTop: number; innerText: string; outerText: string; diff --git a/packages/happy-dom/test/nodes/html-element/HTMLElement.test.ts b/packages/happy-dom/test/nodes/html-element/HTMLElement.test.ts index c75b856ff..7ca889a2d 100644 --- a/packages/happy-dom/test/nodes/html-element/HTMLElement.test.ts +++ b/packages/happy-dom/test/nodes/html-element/HTMLElement.test.ts @@ -44,7 +44,9 @@ describe('HTMLElement', () => { 'offsetLeft', 'offsetTop', 'clientHeight', - 'clientWidth' + 'clientWidth', + 'clientLeft', + 'clientTop' ]) { describe(`${property}`, () => { it('Returns "0".', () => {