This repository was archived by the owner on Aug 14, 2021. It is now read-only.
This repository was archived by the owner on Aug 14, 2021. It is now read-only.
Add option to prevent text selection #12
Closed
Description
When right-clicking a div-tag the contained text sometimes is marked as selected by the browser. (Observed with Safari on a MacBook, using two-finger click on the trackpad).
An option disableSelection: true
could help to prevent this.
jQuery UI implemented it this way (note: this function is deprecated since 1.9):
$.support.selectstart = "onselectstart" in document.createElement( "div" );
$.fn.extend({
disableSelection: function() {
return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
".ui-disableSelection", function( event ) {
event.preventDefault();
});
},
enableSelection: function() {
return this.unbind( ".ui-disableSelection" );
},