The Event Processor has an additional feature which enables the developer to specify that certain regions of text may not be selected using the mouse. This feature is important when a user interface component needs to support dragging or multiple successive clicks. In such situations, the default behavior of the browser may be to select text (when dragging) or highlight a word or sentence (when the user double/triple clicks the mouse).
This capability is handled in different ways on different browser platforms. In most browsers, mousedown
event listeners are registered and any received events are consumed. In Internet Explorer, a selectstart
event handler is registered to consume any selection events.
To disable selection on a particular element, invoke Core.Web.Event.Selection.disable(element)
. To re-enable it, invoke the Core.Web.Event.Selection.enable(element)
method. Note that invoking Core.Web.Event.removeAll(element)
will also dispose of any "selection denial" listener.
Note: This feature is not intended to be used as any form of "content protection", and would be ineffective for such a purpose.