]> source.dussan.org Git - jquery-ui.git/commitdiff
Core: Don't create `$.support.selectstart`
authorScott González <scott.gonzalez@gmail.com>
Thu, 3 Apr 2014 14:52:30 +0000 (10:52 -0400)
committerScott González <scott.gonzalez@gmail.com>
Thu, 3 Apr 2014 14:52:30 +0000 (10:52 -0400)
ui/core.js

index a946d522b395fc0fcbdf73e04f63832626792597..35930866ba3c63349957edeadbc6bdac1abb3157 100644 (file)
@@ -207,7 +207,6 @@ if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
 // deprecated
 $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
 
-$.support.selectstart = "onselectstart" in document.createElement( "div" );
 $.fn.extend({
        focus: (function( orig ) {
                return function( delay, fn ) {
@@ -225,12 +224,17 @@ $.fn.extend({
                };
        })( $.fn.focus ),
 
-       disableSelection: function() {
-               return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
-                       ".ui-disableSelection", function( event ) {
+       disableSelection: (function() {
+               var eventType = "onselectstart" in document.createElement( "div" ) ?
+                       "selectstart" :
+                       "mousedown";
+
+               return function() {
+                       return this.bind( eventType + ".ui-disableSelection", function( event ) {
                                event.preventDefault();
                        });
-       },
+               };
+       })(),
 
        enableSelection: function() {
                return this.unbind( ".ui-disableSelection" );