Draft
This page is not complete.
A DOMRect
describes the size and position of a rectangle.
The type of box represented by the DOMRect
is specified by the method or property that returned it. For example, VREyeParameters.renderRect
from the WebVR API specifies the viewport of a canvas into which visuals for one eye of a head mounted display should be rendered.
It inherits from its parent, DOMRectReadOnly
.
Constructor
DOMRect()
- Creates a new
DOMRect
object.
Properties
DOMRect
inherits properties from its parent, DOMRectReadOnly
. The difference is that they are not read-only anymore.
DOMRectReadOnly.x
- The x coordinate of the
DOMRect
's origin (typically the top-left corner of the rectangle). DOMRectReadOnly.y
- The y coordinate of the
DOMRect
's origin (typically the top-left corner of the rectangle). DOMRectReadOnly.width
- The width of the
DOMRect
. DOMRectReadOnly.height
- The height of the
DOMRect
. DOMRectReadOnly.top
- Returns the top coordinate value of the
DOMRect
(has the same value asy
, ory + height
ifheight
is negative.) DOMRectReadOnly.right
- Returns the right coordinate value of the
DOMRect
(has the same value asx + width
, orx
ifwidth
is negative.) DOMRectReadOnly.bottom
- Returns the bottom coordinate value of the
DOMRect
(has the same value asy + height
, ory
ifheight
is negative.) DOMRectReadOnly.left
- Returns the left coordinate value of the
DOMRect
(has the same value asx
, orx + width
ifwidth
is negative.)
Methods
DOMRect
inherits methods from its parent, DOMRectReadOnly
.
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 'DOMRect' in that specification. |
Candidate Recommendation | Initial definition. |
Browser compatibility
BCD tables only load in the browser