DOMRectReadOnly: DOMRectReadOnly() コンストラクター
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
DOMRectReadOnly()
コンストラクターは新しい DOMRectReadOnly
オブジェクトを生成します。
構文
js
new DOMRectReadOnly(x, y, width, height)
引数
例
新しい DOMRectReadOnly
を作成するには、次のようなコード行を実行します。
js
const myDOMRect = new DOMRectReadOnly(0, 0, 100, 100);
// 'myDOMRect' をコンソールで実行すると、次の行が返ります。
// DOMRectReadOnly { 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