Skip to content

Commit d24cd35

Browse files
committed
Core: Don't create $.support.selectstart
1 parent 0059722 commit d24cd35

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

ui/core.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
207207
// deprecated
208208
$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
209209

210-
$.support.selectstart = "onselectstart" in document.createElement( "div" );
211210
$.fn.extend({
212211
focus: (function( orig ) {
213212
return function( delay, fn ) {
@@ -225,12 +224,17 @@ $.fn.extend({
225224
};
226225
})( $.fn.focus ),
227226

228-
disableSelection: function() {
229-
return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
230-
".ui-disableSelection", function( event ) {
227+
disableSelection: (function() {
228+
var eventType = "onselectstart" in document.createElement( "div" ) ?
229+
"selectstart" :
230+
"mousedown";
231+
232+
return function() {
233+
return this.bind( eventType + ".ui-disableSelection", function( event ) {
231234
event.preventDefault();
232235
});
233-
},
236+
};
237+
})(),
234238

235239
enableSelection: function() {
236240
return this.unbind( ".ui-disableSelection" );

0 commit comments

Comments
 (0)