--- title: Selection.extend() slug: Web/API/Selection/extend translation_of: Web/API/Selection/extend ---
Selection.extend()
方法移动选中区的焦点到指定的点。选中区的锚点不会移动。选中区将从锚点开始到新的焦点,不管方向。
sel.extend(node, offset)
node
内的偏移位置。如果没有指定,使用 0
作为默认值。Specification | Status | Comment |
---|---|---|
{{SpecName('HTML Editing', '#dom-selection-extend', 'Selection.extend()')}} | {{Spec2('HTML Editing')}} | Initial definition |
{{SpecName('Selection API', '#widl-Selection-extend-void-Node-node-unsigned-long-offset', 'Selection.extend()')}} | {{Spec2('Selection API')}} | Current |