diff options
author | Scott González <scott.gonzalez@gmail.com> | 2014-04-03 10:52:30 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2014-04-03 10:52:30 -0400 |
commit | d24cd35f0cf211a5fed379532f1d9c762f39b9e2 (patch) | |
tree | 36902fafe036632c5a67c999cda292751865ca41 /ui/core.js | |
parent | 0059722b6b43c4985dbbd5f1494524442c12ddb0 (diff) | |
download | jquery-ui-d24cd35f0cf211a5fed379532f1d9c762f39b9e2.tar.gz jquery-ui-d24cd35f0cf211a5fed379532f1d9c762f39b9e2.zip |
Core: Don't create `$.support.selectstart`
Diffstat (limited to 'ui/core.js')
-rw-r--r-- | ui/core.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ui/core.js b/ui/core.js index a946d522b..35930866b 100644 --- a/ui/core.js +++ b/ui/core.js @@ -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" ); |