DOMRect: fromRect() static method

Note: This feature is available in Web Workers.

The fromRect() static method of the DOMRect object creates a new DOMRect object with a given location and dimensions.

Syntax

js
DOMRect.fromRect()
DOMRect.fromRect(rectangle)

Parameters

rectangle Optional

An object specifying the location and dimensions of a rectangle. All properties default to 0. The properties are:

Return value

An instance of DOMRect.

Specifications