MDN self-hosted library · e01.org

DOMRect: DOMRect() constructor

Geometry Interfaces

no runnable cells web-api-constructor upstream source

Geometry Interfaces

The DOMRect() constructor creates a new DOMRect object.

Syntax

new DOMRect(x, y, width, height)

Parameters

  • x
  • : The x coordinate of the DOMRect's origin.
  • y
  • : The y coordinate of the DOMRect's origin.
  • width
  • : The width of the DOMRect.
  • height
  • : The height of the DOMRect.

Return value

A new DOMRect object.

Specifications

Browser compatibility

See also

  • DOMPoint
  • DOMRect
  • DOMRect.fromRect()