mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Tooltip: Only bind remove handler for delegated tooltips
The remove handler was being added for every tooltip, but only removed for delegated tooltips. The default destroy behavior already handles non-delegated tooltips, so the handler should only be added for delegated tooltips. Fixes #9531 Closes gh-1156
This commit is contained in:
parent
247257ebc9
commit
a8ff77360b
15
ui/jquery.ui.tooltip.js
vendored
15
ui/jquery.ui.tooltip.js
vendored
@ -310,11 +310,17 @@ $.widget( "ui.tooltip", {
|
||||
fakeEvent.currentTarget = target[0];
|
||||
this.close( fakeEvent, true );
|
||||
}
|
||||
},
|
||||
remove: function() {
|
||||
this._removeTooltip( tooltip );
|
||||
}
|
||||
};
|
||||
|
||||
// Only bind remove handler for delegated targets. Non-delegated
|
||||
// tooltips will handle this in destroy.
|
||||
if ( target[ 0 ] !== this.element[ 0 ] ) {
|
||||
events.remove = function() {
|
||||
this._removeTooltip( tooltip );
|
||||
};
|
||||
}
|
||||
|
||||
if ( !event || event.type === "mouseover" ) {
|
||||
events.mouseleave = "close";
|
||||
}
|
||||
@ -353,8 +359,9 @@ $.widget( "ui.tooltip", {
|
||||
|
||||
target.removeData( "ui-tooltip-open" );
|
||||
this._off( target, "mouseleave focusout keyup" );
|
||||
|
||||
// Remove 'remove' binding only on delegated targets
|
||||
if ( target[0] !== this.element[0] ) {
|
||||
if ( target[ 0 ] !== this.element[ 0 ] ) {
|
||||
this._off( target, "remove" );
|
||||
}
|
||||
this._off( this.document, "mousemove" );
|
||||
|
Loading…
Reference in New Issue
Block a user