JavaScripture
Contribute via GitHub Feedback

DOMRect : DOMRectReadOnly

DOMRect describes a rectangular region an element occupies in the viewport. The Element.getBoundingClientRect() method returns a DOMRect containing the position of the Element. Element.getClientRects() returns a DOMRectList containing a list of DOMRects for each portion of the Element (ie, a text Element may have multiple rects if it was split across 2 lines).

Constructors

new DOMRect([x = 0 : Number, [y = 0 : Number, [width = 0 : Number, [height = 0 : Number]]]]) : DOMRect

Instance Properties

height : Number

The height of the element.

width : Number

The width of the element.

x : Number

The distance of the element to the left of the viewport.

y : Number

The distance of the element to the top of the viewport.

DOMRect Methods

fromRect(rect : Object) : DOMRect
rect : {
x :Number
y :Number
width :Number
height :Number
}