Selection: extend() method
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.
The Selection.extend()
method moves the focus of the
selection to a specified point. The anchor of the selection does not move. The selection
will be from the anchor to the new focus, regardless of direction.
Syntax
js
extend(node)
extend(node, offset)
Parameters
node
-
The node within which the focus will be moved.
offset
Optional-
The offset position within
node
where the focus will be moved to. If not specified, the default value0
is used.
Return value
None (undefined
).
Specifications
Specification |
---|
Selection API # dom-selection-extend |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
extend | ||||||||||||
Accepts node parameter in any tree/shadow tree | ||||||||||||
offset parameter is optional |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- In development. Supported in a pre-release version.
- In development. Supported in a pre-release version.
- No support
- No support
- Experimental. Expect behavior to change in the future.
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.
See also
Selection
, the interface it belongs to.