diff --git a/tests/visual/selectmenu/methods.html b/tests/visual/selectmenu/methods.html
index 1cb5274441..5476dfff8f 100644
--- a/tests/visual/selectmenu/methods.html
+++ b/tests/visual/selectmenu/methods.html
@@ -4,7 +4,7 @@
jQuery UI Selectmenu - Event functionality
-
+
@@ -15,21 +15,21 @@
+
@@ -15,11 +15,11 @@
+
@@ -14,9 +14,9 @@
-
+
diff --git a/tests/visual/theme.html b/tests/visual/theme.html
index d10f2444f3..131cc41d70 100644
--- a/tests/visual/theme.html
+++ b/tests/visual/theme.html
@@ -4,7 +4,7 @@
jQuery UI Example Page
-
+
diff --git a/tests/visual/tooltip/animations.html b/tests/visual/tooltip/animations.html
index b1ffc89146..993fbbd859 100644
--- a/tests/visual/tooltip/animations.html
+++ b/tests/visual/tooltip/animations.html
@@ -4,7 +4,7 @@
Tooltip Visual Test: Default
-
+
diff --git a/tests/visual/tooltip/callout.html b/tests/visual/tooltip/callout.html
index 3a498b2a65..79d8d32bfa 100644
--- a/tests/visual/tooltip/callout.html
+++ b/tests/visual/tooltip/callout.html
@@ -4,7 +4,7 @@
Tooltip Visual Test: Default
-
+
diff --git a/tests/visual/tooltip/tooltip.html b/tests/visual/tooltip/tooltip.html
index 5eb1ab0a78..b282a73b7b 100644
--- a/tests/visual/tooltip/tooltip.html
+++ b/tests/visual/tooltip/tooltip.html
@@ -4,7 +4,7 @@
Tooltip Visual Test: Default
-
+
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index 9871b52d77..dbda2058ed 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -184,6 +184,7 @@ $.widget( "ui.autocomplete", {
}
clearTimeout( self.searching );
+ self.cancelSearch = true;
// clicks on the menu (or a button to trigger a search) will cause a blur event
self.closing = setTimeout(function() {
self.close( event );
@@ -373,6 +374,7 @@ $.widget( "ui.autocomplete", {
_search: function( value ) {
this.pending++;
this.element.addClass( "ui-autocomplete-loading" );
+ this.cancelSearch = false;
this.source( { term: value }, this.response );
},
@@ -382,7 +384,7 @@ $.widget( "ui.autocomplete", {
content = this._normalize( content );
}
this._trigger( "response", null, { content: content } );
- if ( !this.options.disabled && content && content.length ) {
+ if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
this._suggest( content );
this._trigger( "open" );
} else {
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index e09dc5a50e..45ddf8678e 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -799,9 +799,10 @@ $.extend(Datepicker.prototype, {
if (this._datepickerShowing) {
var showAnim = this._get(inst, 'showAnim');
var duration = this._get(inst, 'duration');
+ var self = this;
var postProcess = function() {
$.datepicker._tidyDialog(inst);
- this._curInst = null;
+ self._curInst = null;
};
// DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
diff --git a/ui/jquery.ui.droppable.js b/ui/jquery.ui.droppable.js
index 3942c6b8f4..62bba2abad 100644
--- a/ui/jquery.ui.droppable.js
+++ b/ui/jquery.ui.droppable.js
@@ -224,7 +224,7 @@ $.ui.ddmanager = {
if(!this.options) return;
if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
- dropped = dropped || this._drop.call(this, event);
+ dropped = this._drop.call(this, event) || dropped;
if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
this.isout = 1; this.isover = 0;
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index bf36a77fe7..4fe859f4ea 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -40,16 +40,6 @@ $.widget( "ui.menu", {
id: this.menuId,
role: "menu"
})
- // Prevent focus from sticking to links inside menu after clicking
- // them (focus should always stay on UL during navigation).
- // If the link is clicked, redirect focus to the menu.
- // TODO move to _bind below
- .bind( "mousedown.menu", function( event ) {
- if ( $( event.target).is( "a" ) ) {
- event.preventDefault();
- $( this ).focus( 1 );
- }
- })
// need to catch all clicks on disabled menu
// not possible through _bind
.bind( "click.menu", $.proxy( function( event ) {
@@ -58,6 +48,11 @@ $.widget( "ui.menu", {
}
}, this));
this._bind({
+ // Prevent focus from sticking to links inside menu after clicking
+ // them (focus should always stay on UL during navigation).
+ "mousedown .ui-menu-item > a": function( event ) {
+ event.preventDefault();
+ },
"click .ui-menu-item:has(a)": function( event ) {
event.stopImmediatePropagation();
var target = $( event.currentTarget );
@@ -66,6 +61,8 @@ $.widget( "ui.menu", {
this.focus( event, target );
}
this.select( event );
+ // Redirect focus to the menu.
+ this.element.focus();
},
"mouseover .ui-menu-item": function( event ) {
event.stopImmediatePropagation();
diff --git a/ui/jquery.ui.selectable.js b/ui/jquery.ui.selectable.js
index d7b24d4e39..408771eff7 100644
--- a/ui/jquery.ui.selectable.js
+++ b/ui/jquery.ui.selectable.js
@@ -104,7 +104,7 @@ $.widget("ui.selectable", $.ui.mouse, {
this.selectees.filter('.ui-selected').each(function() {
var selectee = $.data(this, "selectable-item");
selectee.startselected = true;
- if (!event.metaKey) {
+ if (!event.metaKey && !event.ctrlKey) {
selectee.$element.removeClass('ui-selected');
selectee.selected = false;
selectee.$element.addClass('ui-unselecting');
@@ -119,7 +119,7 @@ $.widget("ui.selectable", $.ui.mouse, {
$(event.target).parents().andSelf().each(function() {
var selectee = $.data(this, "selectable-item");
if (selectee) {
- var doSelect = !event.metaKey || !selectee.$element.hasClass('ui-selected');
+ var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');
selectee.$element
.removeClass(doSelect ? "ui-unselecting" : "ui-selected")
.addClass(doSelect ? "ui-selecting" : "ui-unselecting");
@@ -189,7 +189,7 @@ $.widget("ui.selectable", $.ui.mouse, {
} else {
// UNSELECT
if (selectee.selecting) {
- if (event.metaKey && selectee.startselected) {
+ if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
selectee.$element.removeClass('ui-selecting');
selectee.selecting = false;
selectee.$element.addClass('ui-selected');
@@ -208,7 +208,7 @@ $.widget("ui.selectable", $.ui.mouse, {
}
}
if (selectee.selected) {
- if (!event.metaKey && !selectee.startselected) {
+ if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
selectee.$element.removeClass('ui-selected');
selectee.selected = false;
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 53cde389e2..4f47a008b0 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -374,37 +374,31 @@ $.Widget.prototype = {
},
_trigger: function( type, event, data ) {
- var callback = this.options[ type ],
- args;
+ var prop, orig,
+ callback = this.options[ type ];
+ data = data || {};
event = $.Event( event );
event.type = ( type === this.widgetEventPrefix ?
type :
this.widgetEventPrefix + type ).toLowerCase();
- data = data || {};
+ // the original event may come from any element
+ // so we need to reset the target on the new event
+ event.target = this.element[ 0 ];
// copy original event properties over to the new event
- // this would happen if we could call $.event.fix instead of $.Event
- // but we don't have a way to force an event to be fixed multiple times
- if ( event.originalEvent ) {
- for ( var i = $.event.props.length, prop; i; ) {
- prop = $.event.props[ --i ];
- event[ prop ] = event.originalEvent[ prop ];
+ orig = event.originalEvent;
+ if ( orig ) {
+ for ( prop in orig ) {
+ if ( !( prop in event ) ) {
+ event[ prop ] = orig[ prop ];
+ }
}
}
- // the original event may come from any element
- // so we need to reset the target on the new event
- event.target = this.element[0];
-
this.element.trigger( event, data );
-
- args = $.isArray( data ) ?
- [ event ].concat( data ) :
- [ event, data ];
-
return !( $.isFunction( callback ) &&
- callback.apply( this.element[0], args ) === false ||
+ callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
event.isDefaultPrevented() );
}
};