diff options
author | Scott González <scott.gonzalez@gmail.com> | 2014-01-02 16:51:32 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2014-01-09 04:12:35 -0500 |
commit | a8ff77360b78b7eabcffd97b8b11c2d1f150ed4e (patch) | |
tree | baed58e169c4f984343a7ac907281dcaee184f0d /ui | |
parent | 247257ebc9678fba708fc8f3f6835a95afaf2074 (diff) | |
download | jquery-ui-a8ff77360b78b7eabcffd97b8b11c2d1f150ed4e.tar.gz jquery-ui-a8ff77360b78b7eabcffd97b8b11c2d1f150ed4e.zip |
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
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.tooltip.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 6854032f4..a8c3c14bd 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -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" ); |