Selection and range properties in JavaScript
TextRange properties:
Range properties:
Selection properties:
TextRanges properties:
ControlRange properties:
SelectionRange properties:
Property | Support | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
boundingHeight (TextRange) |
Returns an integer value that specifies the height of the rectangle that bounds the current TextRange object, in pixels. | |||||||||||
boundingLeft (TextRange) |
Returns an integer value that specifies the left coordinate of the rectangle that bounds the current TextRange object, in pixels. | |||||||||||
boundingTop (TextRange) |
Returns an integer value that specifies the top coordinate of the rectangle that bounds the current TextRange object, in pixels. | |||||||||||
boundingWidth (TextRange) |
Returns an integer value that specifies the width of the rectangle that bounds the current TextRange object, in pixels. | |||||||||||
htmlText (TextRange) |
Returns the HTML source that belongs to a TextRange object as a string. | |||||||||||
text (TextRange) |
|
Sets or retrieves a string that specifies the text within a TextRange object. |
Property | Support | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
collapsed (Range) |
|
Returns a Boolean value that indicates whether the start and end points of the current Range are in the same position. | ||||||||||
commonAncestorContainer (Range) |
|
Returns a reference to the deepest node in the DOM hierarchy that contains the entire Range object. | ||||||||||
endContainer (Range) |
|
Returns a reference to the deepest node in the DOM hierarchy that contains the end point of the current Range object. | ||||||||||
endOffset (Range) |
|
Returns an integer that specifies the end position of the current Range relative to the endContainer element. | ||||||||||
startContainer (Range) |
|
Returns a reference to the deepest node in the DOM hierarchy that contains the start point of the current Range object. | ||||||||||
startOffset (Range) |
|
Returns an integer that specifies the start position of the current Range relative to the startContainer element. |
Property | Support | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
selection (document) |
|
Represents the currently selected part of the document. | ||||||||||
type (selection) |
|
Returns a string value that identifies the content type of the current selection. |
Property | Support | Description | |||||
---|---|---|---|---|---|---|---|
length (TextRanges) |
Returns an integer that specifies the number of objects in the current collection. |
Property | Support | Description | |||||
---|---|---|---|---|---|---|---|
length (controlRange) |
Returns an integer that specifies the number of objects in the current collection. |
Property | Support | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
anchorNode (selectionRange) |
|
Returns a reference to the node where the selection begins. | ||||||||||
anchorOffset (selectionRange) |
|
Returns the start position of the selection relative to the anchor node. | ||||||||||
focusNode (selectionRange) |
|
Returns a reference to the element where the selection ends. | ||||||||||
focusOffset (selectionRange) |
|
Returns the end position of the selection relative to the focus node. | ||||||||||
isCollapsed (selectionRange) |
|
Returns a Boolean value that indicates whether the anchor and focus points of the current selectionRange object are in the same position. | ||||||||||
rangeCount (selectionRange) |
|
Returns the number of Range objects that belong to the current selection. |
User Contributed Comments