Web/API/DOMRectReadOnly

From Get docs

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.

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 Status Comment
Geometry Interfaces Module Level 1The definition of 'DOMRectReadOnly' in that specification. Candidate Recommendation Initial definition.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
DOMRectReadOnly Chrome

Full support 61

Edge Full support 79


Full support 79


Full support 12

Alternate Name'

Alternate Name' Uses the non-standard name: ClientRect

Firefox

Full support 31

IE No support No


No support No


Full support Yes

Alternate Name'

Alternate Name' Uses the non-standard name: ClientRect

Opera

Full support 48

Safari

Full support 10.1

WebView Android

Full support 61

Chrome Android

Full support 61

Firefox Android

Full support 31

Opera Android

Full support 45

Safari iOS

Full support 10.3

Samsung Internet Android

Full support 8.0

DOMRectReadOnly() constructor Chrome

Full support 61

Edge

Full support 79

Firefox

Full support 62

IE

No support No

Opera

Full support 48

Safari

Full support 10.1

WebView Android

Full support 61

Chrome Android

Full support 61

Firefox Android

Full support 62

Opera Android

Full support 45

Safari iOS

Full support 10.3

Samsung Internet Android

Full support 8.0

bottom Chrome

Full support 61

Edge

Full support 79

Firefox

Full support 31

IE No support No

Notes'

No support No

Notes'

Notes' Implemented on the proprietary ClientRect interface.

Opera

Full support 48

Safari

Full support 10.1

WebView Android

Full support 61

Chrome Android

Full support 61

Firefox Android

Full support 31

Opera Android

Full support 45

Safari iOS

Full support 10.3

Samsung Internet Android

Full support 8.0

fromRect() static function Chrome

Full support 61

Edge

Full support 79

Firefox

Full support 69

IE

No support No

Opera

Full support 48

Safari

Full support 10.1

WebView Android

Full support 61

Chrome Android

Full support 61

Firefox Android

No support No

Opera Android

Full support 45

Safari iOS

Full support 10.3

Samsung Internet Android

Full support 8.0

height Chrome

Full support 61

Edge

Full support 79

Firefox

Full support 31

IE No support No

Notes'

No support No

Notes'

Notes' Implemented on the proprietary ClientRect interface.

Opera

Full support 48

Safari

Full support 10.1

WebView Android

Full support 61

Chrome Android

Full support 61

Firefox Android

Full support 31

Opera Android

Full support 45

Safari iOS

Full support 10.3

Samsung Internet Android

Full support 8.0

left Chrome

Full support 61

Edge

Full support 79

Firefox

Full support 31

IE No support No

Notes'

No support No

Notes'

Notes' Implemented on the proprietary ClientRect interface.

Opera

Full support 48

Safari

Full support 10.1

WebView Android

Full support 61

Chrome Android

Full support 61

Firefox Android

Full support 31

Opera Android

Full support 45

Safari iOS

Full support 10.3

Samsung Internet Android

Full support 8.0

right Chrome

Full support 61

Edge

Full support 79

Firefox

Full support 31

IE No support No

Notes'

No support No

Notes'

Notes' Implemented on the proprietary ClientRect interface.

Opera

Full support 48

Safari

Full support 10.1

WebView Android

Full support 61

Chrome Android

Full support 61

Firefox Android

Full support 31

Opera Android

Full support 45

Safari iOS

Full support 10.3

Samsung Internet Android

Full support 8.0

top Chrome

Full support 61

Edge

Full support 79

Firefox

Full support 31

IE No support No

Notes'

No support No

Notes'

Notes' Implemented on the proprietary ClientRect interface.

Opera

Full support 48

Safari

Full support 10.1

WebView Android

Full support 61

Chrome Android

Full support 61

Firefox Android

Full support 31

Opera Android

Full support 45

Safari iOS

Full support 10.3

Samsung Internet Android

Full support 8.0

width Chrome

Full support 61

Edge

Full support 79

Firefox

Full support 31

IE No support No

Notes'

No support No

Notes'

Notes' Implemented on the proprietary ClientRect interface.

Opera

Full support 48

Safari

Full support 10.1

WebView Android

Full support 61

Chrome Android

Full support 61

Firefox Android

Full support 31

Opera Android

Full support 45

Safari iOS

Full support 10.3

Samsung Internet Android

Full support 8.0

Available in workers Chrome

Full support 61

Edge

Full support 79

Firefox

Full support 69

IE

No support No

Opera

Full support 48

Safari

Full support 10.1

WebView Android

Full support 61

Chrome Android

Full support 61

Firefox Android

No support No

Opera Android

Full support 45

Safari iOS

Full support 10.3

Samsung Internet Android

Full support 8.0

x Chrome

Full support 61

Edge

Full support 79

Firefox

Full support 31

IE

No support No

Opera

Full support 48

Safari

Full support 10.1

WebView Android

Full support 61

Chrome Android

Full support 61

Firefox Android

Full support 31

Opera Android

Full support 45

Safari iOS

Full support 10.3

Samsung Internet Android

Full support 8.0

y Chrome

Full support 61

Edge

Full support 79

Firefox

Full support 31

IE

No support No

Opera

Full support 48

Safari

Full support 10.1

WebView Android

Full support 61

Chrome Android

Full support 61

Firefox Android

Full support 31

Opera Android

Full support 45

Safari iOS

Full support 10.3

Samsung Internet Android

Full support 8.0

Legend

Full support  
Full support
No support  
No support
See implementation notes.'
See implementation notes.
Uses a non-standard name.'
Uses a non-standard name.


See also