DOMRectReadOnly: fromRect() static method

Note: This feature is available in Web Workers.

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

Syntax

js
DOMRectReadOnly.fromRect()
DOMRectReadOnly.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 DOMRectReadOnly.

Specifications