diff options
author | Scott González <scott.gonzalez@gmail.com> | 2016-04-20 13:07:53 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2016-04-21 10:59:27 -0400 |
commit | 010f5f9d13b7d6f1c13482825547ee95d3033e40 (patch) | |
tree | dd12424a449a594a01eeee77cfc1c6f4cbc53165 /ui | |
parent | 3585b7a92c2233a1e291f94165c958f270fc0679 (diff) | |
download | jquery-ui-010f5f9d13b7d6f1c13482825547ee95d3033e40.tar.gz jquery-ui-010f5f9d13b7d6f1c13482825547ee95d3033e40.zip |
Tooltip: Fix re-enabling of delegated tooltips
Fixes #14950
Closes gh-1699
Diffstat (limited to 'ui')
-rw-r--r-- | ui/widgets/tooltip.js | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/ui/widgets/tooltip.js b/ui/widgets/tooltip.js index 94021092a..a8f45bc87 100644 --- a/ui/widgets/tooltip.js +++ b/ui/widgets/tooltip.js @@ -114,6 +114,8 @@ $.widget( "ui.tooltip", { } ) .appendTo( this.document[ 0 ].body ); this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" ); + + this.disabledTitles = $( [] ); }, _setOption: function( key, value ) { @@ -143,25 +145,29 @@ $.widget( "ui.tooltip", { } ); // Remove title attributes to prevent native tooltips - this.element.find( this.options.items ).addBack().each( function() { - var element = $( this ); - if ( element.is( "[title]" ) ) { - element - .data( "ui-tooltip-title", element.attr( "title" ) ) - .removeAttr( "title" ); - } - } ); + this.disabledTitles = this.disabledTitles.add( + this.element.find( this.options.items ).addBack() + .filter( function() { + var element = $( this ); + if ( element.is( "[title]" ) ) { + return element + .data( "ui-tooltip-title", element.attr( "title" ) ) + .removeAttr( "title" ); + } + } ) + ); }, _enable: function() { // restore title attributes - this.element.find( this.options.items ).addBack().each( function() { + this.disabledTitles.each( function() { var element = $( this ); if ( element.data( "ui-tooltip-title" ) ) { element.attr( "title", element.data( "ui-tooltip-title" ) ); } } ); + this.disabledTitles = $( [] ); }, open: function( event ) { |