dijit/_editor/selection (version 1.10)

Summary

Deprecated text selection API. Will be removed in 2.0. New code should use dijit/selection.

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)
  • 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 win.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.
  • isTag(node,tags) Function to determine if a node is one of an array of tags.
  • 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)

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)

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.

Returns:undefined
getParentElement()

Get the parent element of the current selection

Returns:undefined | null
getParentOfType(node,tags)

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[]
Returns:DomNode | null

The node to inspect.

getSelectedElement()

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

Returns:undefined | null
getSelectedHtml()

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

Returns:string | null | undefined
getSelectedText()

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

Returns:string | null | undefined
getType()

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

Returns:string | undefined
hasAncestorElement(tagName)

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.

Returns:boolean
inSelection(node)

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

Parameter Type Description
node undefined
Returns:boolean
isTag(node,tags)

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

Parameter Type Description
node DomNode

The node to inspect.

tags String[]
Returns:undefined | string
remove()

Function to delete the currently selected content from the document.

Returns:undefined
selectElement(element,nochangefocus)

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)

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!