Skip to content

Commit

Permalink
chore: [#1408] Fixes review findings
Browse files Browse the repository at this point in the history
  • Loading branch information
capricorn86 committed May 6, 2024
1 parent 636c110 commit 4d6cbe6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
7 changes: 6 additions & 1 deletion packages/happy-dom/src/nodes/element/DOMRect.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import DOMRectReadOnly, { IDOMRectInit } from './DOMRectReadOnly.js';
import DOMRectReadOnly from './DOMRectReadOnly.js';
import * as PropertySymbol from '../../PropertySymbol.js';
import IDOMRectInit from './IDOMRectInit.js';

/* eslint-disable jsdoc/require-jsdoc */

Expand Down Expand Up @@ -40,4 +41,8 @@ export default class DOMRect extends DOMRectReadOnly {
public get height(): number {
return this[PropertySymbol.height];
}

public static fromRect(other: IDOMRectInit): DOMRect {
return new DOMRect(other.x, other.y, other.width, other.height);
}
}
8 changes: 1 addition & 7 deletions packages/happy-dom/src/nodes/element/DOMRectReadOnly.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as PropertySymbol from '../../PropertySymbol.js';
import IDOMRectInit from './IDOMRectInit.js';

/* eslint-disable jsdoc/require-jsdoc */

Expand Down Expand Up @@ -77,10 +78,3 @@ export default class DOMRectReadOnly implements IDOMRectInit {
return new DOMRectReadOnly(other.x, other.y, other.width, other.height);
}
}

export interface IDOMRectInit {
readonly x: number;
readonly y: number;
readonly width: number;
readonly height: number;
}
6 changes: 6 additions & 0 deletions packages/happy-dom/src/nodes/element/IDOMRectInit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default interface IDOMRectInit {
readonly x: number;
readonly y: number;
readonly width: number;
readonly height: number;
}

0 comments on commit 4d6cbe6

Please sign in to comment.