0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Javascript / DOM に於ける 範囲表現

Last updated at Posted at 2025-04-16

範囲表現

レギュレーション

とりあえず何等かの範囲を表現する クラス / 関数 等を上げていくこととします。 関数の場合は引数名、クラスの場合は プロパティ/関数名で それが 開始名 / 長さ / 終了名 のどれにあたるかを記録します。
また、 終了名 にあたるものが 範囲に含まれるかどうかもきろくします

JavaScript API

項目名 開始名 長さ 終了名 終了が含まれるか
Array.prototype.slice() start - end いいえ
String.prototype.substring() indexStart - indexEnd いいえ
Array.prototype.splice() start deleteCount - -
Array.prototype.copyWithin() start - end いいえ

Javascript の 標準メソッド群だと大体 index を元にした 範囲表現となるので基本的には end が含まれない のでは?感あります。

DOM API

項目名 開始名 長さ 終了名 終了が含まれるか
HTMLInputElement selectionStart - selectionEnd はい
HTMLTextAreaElement selectionStart - selectionEnd はい
EditContext selectionStart - selectionEnd はい
TextUpdateEvent selectionStart - selectionEnd はい
TextUpdateEvent updateRangeStart - updateRangeEnd はい
CharacterBoundsUpdateEvent rangeStart - rangeEnd はい
AbstractRange startOffset - endOffset はい
Range startOffset - endOffset はい
Range startContainer - endContainer はい
StaticRange startOffset - endOffset はい
StaticRange startContainer - endContainer はい
TextTrackCue startTime - endTime はい
TextFormat rangeStart - rengeEnd はい
ViewTimeline startOffset - endOffset はい
PerformanceResourceTiming connectStart - connectEnd はい
PerformanceResourceTiming domainLookupStart - domainLookupEnd はい
PerformanceResourceTiming fetchStart - responseEnd はい
PerformanceResourceTiming redirectStart - redirectEnd はい
PerformanceResourceTiming requestStart - responseStart はい
PerformanceNavigationTiming domContentLoadedEventStart - domContentLoadedEventEnd はい
PerformanceNavigationTiming loadEventStart - loadEventEnd はい
AudioBufferSourceNode loopStart - loopEnd はい
SVGTextContentElement getStartPositionOfChar() - getEndPositionOfChar() はい
PerformanceMeasure startTime duration - -

DOM での範囲表現はだいたい クラスによる表現の話となります。 その為、終了は基本的に含まれる形な模様。構造とするならそれはそう という話ではある。

以上。

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?