DOMRectReadOnly: DOMRectReadOnly() コンストラクター
Baseline
広く利用可能
この機能は広く実装されており、多くのバージョンの端末やブラウザーで動作します。2020年1月以降、すべてのブラウザーで利用可能です。
メモ: この機能はウェブワーカー内で利用可能です。
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 }
仕様書
| 仕様書 |
|---|
| Geometry Interfaces Module Level 1 # dom-domrectreadonly-domrectreadonly |