]> source.dussan.org Git - jquery-ui.git/commitdiff
Core: Only use mousedown to prevent text selection in browsers that don't support...
authorScott González <scott.gonzalez@gmail.com>
Mon, 20 Sep 2010 15:53:51 +0000 (11:53 -0400)
committerScott González <scott.gonzalez@gmail.com>
Mon, 20 Sep 2010 15:53:51 +0000 (11:53 -0400)
ui/jquery.ui.core.js

index b52ff9171cdb3b947859d38df27236d92366bf49..99aec2a63116541c0d03969eac78eb209f2ffd8e 100644 (file)
@@ -118,9 +118,8 @@ $.fn.extend({
        },
        
        disableSelection: function() {
-               return this.bind(
-                       "mousedown.ui-disableSelection selectstart.ui-disableSelection",
-                       function( event ) {
+               return this.bind( $.support.selectstart ? "selectstart" : "mousedown" +
+                       ".ui-disableSelection", function( event ) {
                                event.preventDefault();
                        });
        },
@@ -217,8 +216,8 @@ $.extend( $.expr[ ":" ], {
 
 // support
 $(function() {
-       var div = document.createElement( "div" ),
-               body = document.body;
+       var body = document.body,
+               div = body.appendChild( div = document.createElement( "div" ) );
 
        $.extend( div.style, {
                minHeight: "100px",
@@ -227,7 +226,9 @@ $(function() {
                borderWidth: 0
        });
 
-       $.support.minHeight = body.appendChild( div ).offsetHeight === 100;
+       $.support.minHeight = div.offsetHeight === 100;
+       $.support.selectstart = "onselectstart" in div;
+
        // set display to none to avoid a layout bug in IE
        // http://dev.jquery.com/ticket/4014
        body.removeChild( div ).style.display = "none";