DOMRectReadOnly()

DOMRectReadOnly() コンストラクターは新しい DOMRectReadOnly オブジェクトを生成します。

構文

new DOMRectReadOnly(x, y, width, height)

引数

x

DOMRectReadOnly の原点の x 座標です。

y

DOMRectReadOnly の原点の y 座標です。

width

DOMRectReadOnly の幅です。

height

DOMRectReadOnly の高さです。

新しい DOMPoint を作成するには、次のようなコード行を実行します。

const myDOMRect = new DOMRectReadOnly(0, 0, 100, 100)
// 'myDOMRect' をコンソールで実行すると、次の行が返ります。
// DOMRect { x: 0, y: 0, width: 100, height: 100, top: 0, right: 100, bottom: 100, left: 0 }

仕様書

Specification
Geometry Interfaces Module Level 1
# dom-domrectreadonly-domrectreadonly

ブラウザーの互換性

BCD tables only load in the browser

関連情報