dijit/selection (version 1.10)

Summary

Class for monitoring / changing the selection (typically highlighted text) in a given window

Parameter Type Description
win Window

The window to monitor/adjust the selection on.

Method Summary

  • collapse(beginning) Function to collapse (clear), the current selection
  • getAncestorElement(tagName) Return the parent element of the current selection which is of type tagName (or one of the other specified tagName)
  • getBookmark() Retrieves a bookmark that can be used with moveToBookmark to reselect the currently selected range.
  • getParentElement() Get the parent element of the current selection
  • getParentOfType(node,tags) Function to locate a parent node that matches one of a set of tags
  • getSelectedElement() Retrieves the selected element (if any), just in the case that a single element (object like and image or a table) is selected.
  • getSelectedHtml() Return the html text of the current selection or null if unavailable
  • getSelectedText() Return the text (no html tags) included in the current selection or null if no text is selected
  • getType() Get the selection type (like doc.select.type in IE).
  • hasAncestorElement(tagName) Check whether current selection has a parent element which is of type tagName (or one of the other specified tagName)
  • inSelection(node) This function determines if 'node' is in the current selection.
  • isCollapsed() Returns true if there is no text selected
  • isTag(node,tags) Function to determine if a node is one of an array of tags.
  • moveToBookmark(bookmark) Moves current selection to a bookmark.
  • remove() Function to delete the currently selected content from the document.
  • selectElement(element,nochangefocus) clear previous selection and select element (including all its children)
  • selectElementChildren(element,nochangefocus) clear previous selection and select the content of the node (excluding the node itself)

Methods

collapse(beginning)
Defined by dijit/selection

Function to collapse (clear), the current selection

Parameter Type Description
beginning Boolean

Indicates whether to collapse the cursor to the beginning of the selection or end.

getAncestorElement(tagName)
Defined by dijit/selection

Return the parent element of the current selection which is of type tagName (or one of the other specified tagName)

Parameter Type Description
tagName String

The tag name to determine if it has an ancestor of.

getBookmark()
Defined by dijit/selection

Retrieves a bookmark that can be used with moveToBookmark to reselect the currently selected range.

getParentElement()
Defined by dijit/selection

Get the parent element of the current selection

getParentOfType(node,tags)
Defined by dijit/selection

Function to locate a parent node that matches one of a set of tags

Parameter Type Description
node DomNode

The node to inspect.

tags String[]
getSelectedElement()
Defined by dijit/selection

Retrieves the selected element (if any), just in the case that a single element (object like and image or a table) is selected.

getSelectedHtml()
Defined by dijit/selection

Return the html text of the current selection or null if unavailable

getSelectedText()
Defined by dijit/selection

Return the text (no html tags) included in the current selection or null if no text is selected

getType()
Defined by dijit/selection

Get the selection type (like doc.select.type in IE).

hasAncestorElement(tagName)
Defined by dijit/selection

Check whether current selection has a parent element which is of type tagName (or one of the other specified tagName)

Parameter Type Description
tagName String

The tag name to determine if it has an ancestor of.

inSelection(node)
Defined by dijit/selection

This function determines if 'node' is in the current selection.

Parameter Type Description
node undefined
isCollapsed()
Defined by dijit/selection

Returns true if there is no text selected

isTag(node,tags)
Defined by dijit/selection

Function to determine if a node is one of an array of tags.

Parameter Type Description
node DomNode

The node to inspect.

tags String[]
moveToBookmark(bookmark)
Defined by dijit/selection

Moves current selection to a bookmark.

Parameter Type Description
bookmark Object

This should be a returned object from getBookmark().

remove()
Defined by dijit/selection

Function to delete the currently selected content from the document.

selectElement(element,nochangefocus)
Defined by dijit/selection

clear previous selection and select element (including all its children)

Parameter Type Description
element DOMNode

The element to select.

nochangefocus Boolean
Optional

Boolean indicating if the focus should be changed. IE only.

selectElementChildren(element,nochangefocus)
Defined by dijit/selection

clear previous selection and select the content of the node (excluding the node itself)

Parameter Type Description
element DOMNode

The element you wish to select the children content of.

nochangefocus Boolean
Optional

Indicates if the focus should change or not.

Error in the documentation? Can’t find what you are looking for? Let us know!