Browse files

Mouse: Optimize the cancel locator, works around a bug where .add(eve…

…nt.target) in IE8 can take a long time when there are multiple siblings. Fixes #7118 - IE Bug Large ComboBox (Dialog)
  • Loading branch information...
1 parent e34dbfe commit 09e88d6220af2f90197c826ac3a31a0ca97f2c8f Jay Merrifield committed with scottgonzalez May 26, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 ui/jquery.ui.mouse.js
View
2 ui/jquery.ui.mouse.js
@@ -58,7 +58,7 @@ $.widget("ui.mouse", {
var self = this,
btnIsLeft = (event.which == 1),
- elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
+ elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).closest(this.options.cancel).length : false);
@zawaideh
zawaideh added a note Aug 4, 2011

This change is causing an issue with jquery.ui.resizable

If the resizable container has a disabled input with text in it, clicking on the text is cancelled, which results in an error on IE8.

The issue seems to come form $(event.target).parents().length being zero, while $(event.target.closest(this.options.cancel) returning an error on IE8.

I suggest reverting it to the original or changing this to:
elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().length && $(event.target).closest(this.options.cancel).length : false);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
return true;
}

0 comments on commit 09e88d6

Please sign in to comment.