The DOMRectReadOnly interface specifies the standard properties used by DOMRect to define a rectangle whose properties are immutable.
The DOMRectReadOnly interface specifies the standard properties used by DOMRect to define a rectangle whose properties are immutable.
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.
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).
DOMRectReadOnly.fromRect()Creates a new DOMRect object with a given location and dimensions.
| Specification |
|---|
| Geometry Interfaces Module Level 1 # DOMRect |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
DOMRectReadOnly |
61 | 79 | 62 | No | 48 | 10.1 | 61 | 61 | 62 | 45 | 10.3 | 8.0 |
DOMRectReadOnly |
612–61 | 7912–79 | 3127–313–27 | 4 | 489.5–48 | 10.14–11 | 612–61 | 6118–61 | 3127–314–27 | 4510.1–45 | 10.33.2–11 | 8.01.0–8.0 |
bottom |
2 | 12 | 3 | 4 | 9.5 | 4 | 2 | 18 | 4 | 10.1 | 3.2 | 1.0 |
fromRect_static |
61 | 79 | 69 | No | 48 | 10.1 | 61 | 61 | 79 | 45 | 10.3 | 8.0 |
height |
2 | 12 | 3 | 4 | 9.5 | 4 | 2 | 18 | 4 | 10.1 | 3.2 | 1.0 |
left |
2 | 12 | 3 | 4 | 9.5 | 4 | 2 | 18 | 4 | 10.1 | 3.2 | 1.0 |
right |
2 | 12 | 3 | 4 | 9.5 | 4 | 2 | 18 | 4 | 10.1 | 3.2 | 1.0 |
toJSON |
61 | 79 | 62 | No | 48 | 10.1 | 61 | 61 | 62 | 45 | 10.3 | 8.0 |
top |
2 | 12 | 3 | 4 | 9.5 | 4 | 2 | 18 | 4 | 10.1 | 3.2 | 1.0 |
width |
2 | 12 | 3 | 4 | 9.5 | 4 | 2 | 18 | 4 | 10.1 | 3.2 | 1.0 |
worker_support |
61 | 79 | 69 | No | 48 | 10.1 | 61 | 61 | No | 45 | 10.3 | 8.0 |
x |
61 | 79 | 31 | No | 48 | 10.1 | 61 | 61 | 31 | 45 | 10.3 | 8.0 |
y |
61 | 79 | 31 | No | 48 | 10.1 | 61 | 61 | 31 | 45 | 10.3 | 8.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly