collapsed
Summary
The Range.collapsed read-only property returns a Boolean flag indicating whether the start and end points of the Range are at the same position. It returns true if the start and end boundary points of the Range are the same point in the DOM, false if not.
Property of dom/Rangedom/Range
Syntax
Note: This property is read-only.
var result = range.collapsed;
Return Value
Returns an object of type BooleanBoolean
true - start and end boundary points of the Range are the same point in the DOM
false - start and end boundary points of the Range are NOT the same point in the DOM
Examples
var range = document.createRange();
range.setStart(startNode,startOffset);
range.setEnd(endNode,endOffset);
var isCollapsed = range.collapsed;
Notes
Remarks
A collapsed range has its start and end boundary points set to the same value, rendering it empty.
Syntax
isCollapsed = range.collapsed;
Standards information
Related specifications
- DOM
- Living Standard
Attributions
Mozilla Developer Network : [Range.collapsed Article]
Microsoft Developer Network: [collapsed Property Article]