W3cubDocs

/DOM

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 compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support Yes No
No
Yes
Uses the non-standard name: ClientRect
Yes No
No
Yes
Uses the non-standard name: ClientRect
Yes 10.1
DOMRectReadOnly() constructor Yes No Yes No Yes 10.1
fromRect 57 ? ? ? 44 ?
bottom Yes No
No
Implemented on the proprietary ClientRect interface.
Yes No
No
Implemented on the proprietary ClientRect interface.
Yes 10.1
height Yes No
No
Implemented on the proprietary ClientRect interface.
Yes No
No
Implemented on the proprietary ClientRect interface.
Yes 10.1
left Yes No
No
Implemented on the proprietary ClientRect interface.
Yes No
No
Implemented on the proprietary ClientRect interface.
Yes 10.1
right Yes No
No
Implemented on the proprietary ClientRect interface.
Yes No
No
Implemented on the proprietary ClientRect interface.
Yes 10.1
top Yes No
No
Implemented on the proprietary ClientRect interface.
Yes No
No
Implemented on the proprietary ClientRect interface.
Yes 10.1
width Yes No
No
Implemented on the proprietary ClientRect interface.
Yes No
No
Implemented on the proprietary ClientRect interface.
Yes 10.1
x Yes No Yes No Yes 10.1
y Yes No Yes No Yes 10.1
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes Yes No
No
Yes
Uses the non-standard name: ClientRect
Yes Yes 10.1 ?
DOMRectReadOnly() constructor Yes Yes No Yes Yes 10.1 ?
fromRect 57 57 ? ? 44 ? ?
bottom Yes Yes No
No
Implemented on the proprietary ClientRect interface.
Yes Yes 10.1 ?
height Yes Yes No
No
Implemented on the proprietary ClientRect interface.
Yes Yes 10.1 ?
left Yes Yes No
No
Implemented on the proprietary ClientRect interface.
Yes Yes 10.1 ?
right Yes Yes No
No
Implemented on the proprietary ClientRect interface.
Yes Yes 10.1 ?
top Yes Yes No
No
Implemented on the proprietary ClientRect interface.
Yes Yes 10.1 ?
width Yes Yes No
No
Implemented on the proprietary ClientRect interface.
Yes Yes 10.1 ?
x Yes Yes No Yes Yes 10.1 ?
y Yes Yes No Yes Yes 10.1 ?

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly