This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The StaticRange interface provides attributes that track the start and end position of a range, and a boolean attribute indicating whether the current range is collapsed into a single position.
Constructor
StaticRange.StaticRange()- Creates a new
StaticRangeobject.
Properties
StaticRange.startContainer- Returns the start
Nodefor the range. StaticRange.startOffset- Returns the offset into the start node of the range's start position.
StaticRange.endContainer- Returns the end
Nodefor the range. StaticRange.endOffset- Returns the offset into the start node of the range's end position.
StaticRange.collapsed- Returns
trueif the range's start position and end position are the same.
Methods
StaticRange.toRange()- Converts the
StaticRangeobject to aRangeobject.
Specifications
| Specification | Status | Comment |
|---|---|---|
| DOM The definition of 'StaticRange' in that specification. |
Living Standard | |
| Static Range The definition of 'StaticRange' in that specification. |
Editor's Draft | Initial definition. |
Browser compatibility
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.
Update compatibility data on GitHub
| Desktop | Mobile | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Basic support | Chrome Full support 60 | Edge ? | Firefox ? | IE ? | Opera Full support 47 | Safari Full support 10.1 | WebView Android Full support 60 | Chrome Android Full support 60 | Edge Mobile ? | Firefox Android ? | Opera Android Full support 47 | Safari iOS Full support 10.1 | Samsung Internet Android ? |
StaticRange() constructor | Chrome Full support 60 | Edge ? | Firefox ? | IE ? | Opera Full support 47 | Safari ? | WebView Android Full support 60 | Chrome Android Full support 60 | Edge Mobile ? | Firefox Android ? | Opera Android Full support 47 | Safari iOS ? | Samsung Internet Android ? |
startContainer | Chrome Full support 60 | Edge ? | Firefox ? | IE ? | Opera Full support 47 | Safari Full support 10.1 | WebView Android Full support 60 | Chrome Android Full support 60 | Edge Mobile ? | Firefox Android ? | Opera Android Full support 47 | Safari iOS Full support 10.1 | Samsung Internet Android ? |
startOffset | Chrome Full support 60 | Edge ? | Firefox ? | IE ? | Opera Full support 47 | Safari Full support 10.1 | WebView Android Full support 60 | Chrome Android Full support 60 | Edge Mobile ? | Firefox Android ? | Opera Android Full support 47 | Safari iOS Full support 10.1 | Samsung Internet Android ? |
endContainer | Chrome Full support 60 | Edge ? | Firefox ? | IE ? | Opera Full support 47 | Safari Full support 10.1 | WebView Android Full support 60 | Chrome Android Full support 60 | Edge Mobile ? | Firefox Android ? | Opera Android Full support 47 | Safari iOS Full support 10.1 | Samsung Internet Android ? |
endOffset | Chrome Full support 60 | Edge ? | Firefox ? | IE ? | Opera Full support 47 | Safari Full support 10.1 | WebView Android Full support 60 | Chrome Android Full support 60 | Edge Mobile ? | Firefox Android ? | Opera Android Full support 47 | Safari iOS Full support 10.1 | Samsung Internet Android ? |
collapsed | Chrome Full support 60 | Edge ? | Firefox ? | IE ? | Opera Full support 47 | Safari Full support 10.1 | WebView Android Full support 60 | Chrome Android Full support 60 | Edge Mobile ? | Firefox Android ? | Opera Android Full support 47 | Safari iOS Full support 10.1 | Samsung Internet Android ? |
toRange | Chrome Full support 60 | Edge ? | Firefox ? | IE ? | Opera Full support 47 | Safari ? | WebView Android Full support 60 | Chrome Android Full support 60 | Edge Mobile ? | Firefox Android ? | Opera Android Full support 47 | Safari iOS ? | Samsung Internet Android ? |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.
- Experimental. Expect behavior to change in the future.