Constructor
new ve.SelectionState(selection)
#
Like the DOM Selection object, but not updated live from the actual selection
WARNING: the Nodes are still live and mutable, which can change the meaning of the offsets or invalidate the value of isBackwards.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
selection |
ve.SelectionState | Selection | Object | DOM Selection-like object Properties:
|
- Source:
Like the DOM Selection object, but not updated live from the actual selection
WARNING: the Nodes are still live and mutable, which can change the meaning of the offsets or invalidate the value of isBackwards.
Methods
equalsSelection(other) → {boolean}
#
Whether the selection represents is the same range as another DOM Selection-like object
Parameters:
Name | Type | Description |
---|---|---|
other |
Object | DOM Selection-like object |
- Source:
Returns:
True if the anchors/focuses are equal (including null)
- Type
- boolean
flip() → {ve.SelectionState}
#
Returns the selection with the anchor and focus swapped
- Source:
Returns:
selection with anchor/focus swapped. Object-identical to this if isCollapsed
- Type
- ve.SelectionState
getNativeRange(doc) → {Range|null
}
#
null
}
#
Get a range representation of the selection
N.B. Range objects do not show whether the selection is backwards
Parameters:
Name | Type | Description |
---|---|---|
doc |
HTMLDocument | The owner document of the selection nodes |
- Source:
Returns:
- Type
-
Range
|
null
Get a range representation of the selection
N.B.
newNullSelection() → {ve.SelectionState}static
#
Create a selection state object representing no selection
- Source:
Returns:
Object representing no selection
- Type
- ve.SelectionState