DOMRectReadOnly

The DOMRectReadOnly interface specifies the standard properties used by DOMRect to define a rectangle whose properties are immutable.

Constructor

DOMRectReadOnly()

Defined to create a new DOMRectReadOnly object. Note that this constructor cannot be called by 3rd party JavaScript; doing so returns an "Illegal constructor" TypeError.

Instance properties

DOMRectReadOnly.x Read only

The x coordinate of the DOMRect's origin.

DOMRectReadOnly.y Read only

The y coordinate of the DOMRect's origin.

DOMRectReadOnly.width Read only

The width of the DOMRect.

DOMRectReadOnly.height Read only

The height of the DOMRect.

DOMRectReadOnly.top Read only

Returns the top coordinate value of the DOMRect (usually the same as y).

DOMRectReadOnly.right Read only

Returns the right coordinate value of the DOMRect (usually the same as x + width).

DOMRectReadOnly.bottom Read only

Returns the bottom coordinate value of the DOMRect (usually the same as y + height).

DOMRectReadOnly.left Read only

Returns the left coordinate value of the DOMRect (usually the same as x).

Static methods

DOMRectReadOnly.fromRect()

Creates a new DOMRect object with a given location and dimensions.

Specifications

Specification
Geometry Interfaces Module Level 1
# DOMRect

Browser compatibility

BCD tables only load in the browser

See also