DOMRectReadOnly

Draft
This page is not complete.

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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

Constructor

DOMRectReadOnly()
Defined to create a new DOMRectReadOnly object, but note that this constructor cannot be called by 3rd party JavaScript: doing so returns an "Illegal constructor" typeError.

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).

Methods

DOMRectReadOnly.fromRect()
Creates a new DOMRect object with a given location and dimensions.

Specifications

Specification Status Comment
Geometry Interfaces Module Level 1
The definition of 'DOMRectReadOnly' in that specification.
Candidate Recommendation Initial definition.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes

No

Yes1

Yes

No

Yes1

Yes10.1
DOMRectReadOnly() constructor Yes No Yes No Yes10.1
fromRect57 ? ? ?44 ?
bottom Yes No2 Yes No2 Yes10.1
height Yes No2 Yes No2 Yes10.1
left Yes No2 Yes No2 Yes10.1
right Yes No2 Yes No2 Yes10.1
top Yes No2 Yes No2 Yes10.1
width Yes No2 Yes No2 Yes10.1
x Yes No Yes No Yes10.1
y Yes No Yes No Yes10.1
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes Yes

No

Yes1

Yes Yes10.1 ?
DOMRectReadOnly() constructor Yes Yes No Yes Yes10.1 ?
fromRect5757 ? ?44 ? ?
bottom Yes Yes No2 Yes Yes10.1 ?
height Yes Yes No2 Yes Yes10.1 ?
left Yes Yes No2 Yes Yes10.1 ?
right Yes Yes No2 Yes Yes10.1 ?
top Yes Yes No2 Yes Yes10.1 ?
width Yes Yes No2 Yes Yes10.1 ?
x Yes Yes No Yes Yes10.1 ?
y Yes Yes No Yes Yes10.1 ?

1. Supported as ClientRect.

2. Implemented on the proprietary ClientRect interface.

See also

Document Tags and Contributors

Contributors to this page: connorshea, jpmedley, stevenwdv, rolfedh, chrisdavidmills
Last updated by: connorshea,