1 out of 2 rated this helpful - Rate this topic

HTMLSelection object

[This documentation is preliminary and is subject to change.]

Represents the active selection, which is typically a highlighted block of text or other elements in the document. The active selection can be used to complete an action issued by a user or a script.

HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 7.6.1Internet Explorer 9

Standards information

Remarks

You can use the HTMLSelection object as input from the user to identify which portion of the document to act on, or as output to the user to show the results of an action.

Users and scripts can create selections. Users create selections by dragging a finger or mouse over a portion of the document. Scripts create selections by calls to selection methods. To get the active selection, apply the getSelection method to the document object.

A document can have only one selection at a time. Use the isCollapsed property to test whether a selection is empty. Although an empty selection contains nothing, you can use it to mark a position, or place a caret in the document.

 

 

Build date: 3/8/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ