diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-09-20 11:53:51 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-09-20 11:53:51 -0400 |
commit | 47e312b238453c6dae1e15e2828dfd27b8079408 (patch) | |
tree | 22767840365f49ce4e3b10618d41c928c21e849d /ui | |
parent | f04a25f9bf24bcbfa6f9f79b45a6a97bc90ffd1d (diff) | |
download | jquery-ui-47e312b238453c6dae1e15e2828dfd27b8079408.tar.gz jquery-ui-47e312b238453c6dae1e15e2828dfd27b8079408.zip |
Core: Only use mousedown to prevent text selection in browsers that don't support selectstart. Fixes #6080 - Core: disableSelection() disables select elements in Chrome.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.core.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js index b52ff9171..99aec2a63 100644 --- a/ui/jquery.ui.core.js +++ b/ui/jquery.ui.core.js @@ -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"; |