Permalink
Browse files

Core: Move disable-selection into its own module

Ref #9647
  • Loading branch information...
arschmitz committed Jul 15, 2015
1 parent f0260fd commit 4916487440b0c087e6e5996522cf478af26df591
Showing with 51 additions and 20 deletions.
  1. +3 −19 ui/core.js
  2. +46 −0 ui/disable-selection.js
  3. +2 −1 ui/resizable.js
@@ -21,7 +21,9 @@
define( [
"jquery",
"./data",
"./version" ], factory );
"./disable-selection",
"./version"
], factory );
} else {
// Browser globals
@@ -284,24 +286,6 @@ if ( $.fn.jquery.substring( 0, 3 ) === "1.7" ) {
// deprecated
$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
$.fn.extend( {
disableSelection: ( function() {
var eventType = "onselectstart" in document.createElement( "div" ) ?
"selectstart" :
"mousedown";
return function() {
return this.on( eventType + ".ui-disableSelection", function( event ) {
event.preventDefault();
} );
};
} )(),
enableSelection: function() {
return this.off( ".ui-disableSelection" );
}
} );
// $.ui.plugin is deprecated. Use $.widget() extensions instead.
$.ui.plugin = {
add: function( module, option, set ) {
@@ -0,0 +1,46 @@
/*!
* jQuery UI Disable Selection @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: disableSelection
//>>group: Core
//>>description: Disable selection of text content within the set of matched elements.
//>>docs: http://api.jqueryui.com/disableSelection/
// This file is deprecated
( function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} ( function( $ ) {
return $.fn.extend( {
disableSelection: ( function() {
var eventType = "onselectstart" in document.createElement( "div" ) ?
"selectstart" :
"mousedown";
return function() {
return this.on( eventType + ".ui-disableSelection", function( event ) {
event.preventDefault();
} );
};
} )(),
enableSelection: function() {
return this.off( ".ui-disableSelection" );
}
} );
} ) );
@@ -23,8 +23,9 @@
define([
"jquery",
"./core",
"./version",
"./disable-selection",
"./mouse",
"./version",
"./widget"
], factory );
} else {

0 comments on commit 4916487

Please sign in to comment.