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

Static 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

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
DOMRectReadOnlyChrome Full support YesEdge No support No
No support No
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: ClientRect
Firefox Full support YesIE No support No
No support No
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: ClientRect
Opera Full support YesSafari Full support 10.1WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support 10.3Samsung Internet Android ?
DOMRectReadOnly() constructorChrome Full support YesEdge No support NoFirefox Full support YesIE No support NoOpera Full support YesSafari Full support 10.1WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support 10.3Samsung Internet Android ?
bottomChrome Full support YesEdge No support No
Notes
No support No
Notes
Notes Implemented on the proprietary ClientRect interface.
Firefox Full support YesIE No support No
Notes
No support No
Notes
Notes Implemented on the proprietary ClientRect interface.
Opera Full support YesSafari Full support 10.1WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support 10.3Samsung Internet Android ?
fromRect() static functionChrome Full support 57Edge No support NoFirefox Full support 69IE No support NoOpera Full support 44Safari Full support 10.1WebView Android Full support 57Chrome Android Full support 57Firefox Android No support NoOpera Android Full support 43Safari iOS Full support 10.3Samsung Internet Android Full support Yes
heightChrome Full support YesEdge No support No
Notes
No support No
Notes
Notes Implemented on the proprietary ClientRect interface.
Firefox Full support YesIE No support No
Notes
No support No
Notes
Notes Implemented on the proprietary ClientRect interface.
Opera Full support YesSafari Full support 10.1WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support 10.3Samsung Internet Android ?
leftChrome Full support YesEdge No support No
Notes
No support No
Notes
Notes Implemented on the proprietary ClientRect interface.
Firefox Full support YesIE No support No
Notes
No support No
Notes
Notes Implemented on the proprietary ClientRect interface.
Opera Full support YesSafari Full support 10.1WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support 10.3Samsung Internet Android ?
rightChrome Full support YesEdge No support No
Notes
No support No
Notes
Notes Implemented on the proprietary ClientRect interface.
Firefox Full support YesIE No support No
Notes
No support No
Notes
Notes Implemented on the proprietary ClientRect interface.
Opera Full support YesSafari Full support 10.1WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support 10.3Samsung Internet Android ?
topChrome Full support YesEdge No support No
Notes
No support No
Notes
Notes Implemented on the proprietary ClientRect interface.
Firefox Full support YesIE No support No
Notes
No support No
Notes
Notes Implemented on the proprietary ClientRect interface.
Opera Full support YesSafari Full support 10.1WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support 10.3Samsung Internet Android ?
widthChrome Full support YesEdge No support No
Notes
No support No
Notes
Notes Implemented on the proprietary ClientRect interface.
Firefox Full support YesIE No support No
Notes
No support No
Notes
Notes Implemented on the proprietary ClientRect interface.
Opera Full support YesSafari Full support 10.1WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support 10.3Samsung Internet Android ?
Available in workersChrome Full support 58Edge No support NoFirefox Full support 69IE No support NoOpera Full support 45Safari Full support 10.1WebView Android Full support 58Chrome Android Full support 58Firefox Android No support NoOpera Android Full support 43Safari iOS Full support 10.3Samsung Internet Android ?
xChrome Full support YesEdge No support NoFirefox Full support YesIE No support NoOpera Full support YesSafari Full support 10.1WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support 10.3Samsung Internet Android ?
yChrome Full support YesEdge No support NoFirefox Full support YesIE No support NoOpera Full support YesSafari Full support 10.1WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support 10.3Samsung Internet Android ?

Legend

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

See also