MDN self-hosted library · e01.org

DOMRectReadOnly

Geometry Interfaces

no runnable cells web-api-interface upstream source

Geometry Interfaces

The DOMRectReadOnly interface specifies the standard properties (also used by DOMRect) to define a rectangle whose properties are immutable.

Constructor

  • DOMRectReadOnly()
  • : Defined to create a new DOMRectReadOnly object.

Instance properties

  • DOMRectReadOnly.x
  • : Returns the x coordinate of the DOMRectReadOnly's origin.
  • DOMRectReadOnly.y
  • : Returns the y coordinate of the DOMRectReadOnly's origin.
  • DOMRectReadOnly.width
  • : Returns the width of the DOMRectReadOnly.
  • DOMRectReadOnly.height
  • : Returns the height of the DOMRectReadOnly.
  • DOMRectReadOnly.top
  • : Returns the top coordinate value of the DOMRectReadOnly (usually the same as y).
  • DOMRectReadOnly.right
  • : Returns the right coordinate value of the DOMRectReadOnly (usually the same as x + width).
  • DOMRectReadOnly.bottom
  • : Returns the bottom coordinate value of the DOMRectReadOnly (usually the same as y + height).
  • DOMRectReadOnly.left
  • : Returns the left coordinate value of the DOMRectReadOnly (usually the same as x).

Static methods

  • DOMRectReadOnly.fromRect()
  • : Creates a new DOMRectReadOnly object with a given location and dimensions.

Instance methods

  • DOMRectReadOnly.toJSON()
  • : Returns a JSON-serializable plain object representing the DOMRectReadOnly object. Automatically called by JSON.stringify().

Specifications

Browser compatibility

See also

  • DOMPoint