Range: collapsed プロパティ
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.
Range.collapsed
は読み取り専用プロパティで、 Range
の開始点と終了点が同じ位置にあるかどうかを示す論理型フラグを返します。 Range
の開始境界点と終了境界点が DOM 上で同じ位置であれば true
を、そうでなければ false
を返します。
折りたたまれた Range
は空であり(内容を含まない)、 DOM ツリー内の 1 つの点を指定します。範囲を折りたたむには、 Range.collapse()
メソッドを参照してください。
値
論理値。
例
js
let range = document.createRange();
range.setStart(startNode, startOffset);
range.setEnd(endNode, endOffset);
isCollapsed = range.collapsed;
仕様書
Specification |
---|
DOM # ref-for-dom-range-collapsed① |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
collapsed |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.