Skip to content

Commit d43118d

Browse files
committed
Tooltip: Cleanup.
1 parent d4f6f17 commit d43118d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ui/jquery.ui.tooltip.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
var increments = 0;
1818

19-
$.widget("ui.tooltip", {
19+
$.widget( "ui.tooltip", {
2020
options: {
2121
tooltipClass: null,
2222
items: "[title]",
@@ -56,15 +56,16 @@ $.widget("ui.tooltip", {
5656
target.data( "tooltip-title", target.attr( "title" ) );
5757
}
5858
var content = this.options.content.call( target[0], function( response ) {
59-
// IE may instantly serve a cached response, need to give it a chance to finish with _open before that
59+
// IE may instantly serve a cached response for ajax requests
60+
// delay this call to _open so the other call to _open runs first
6061
setTimeout(function() {
6162
// when undefined, it got removeAttr, then ignore (ajax response)
6263
// initially its an empty string, so not undefined
6364
// TODO is there a better approach to enable ajax tooltips to have two updates?
6465
if ( target.attr( "aria-describedby" ) !== undefined ) {
6566
that._open( event, target, response );
6667
}
67-
}, 13 );
68+
}, 1 );
6869
});
6970
if ( content ) {
7071
that._open( event, target, content );
@@ -127,6 +128,7 @@ $.widget("ui.tooltip", {
127128
$( this ).remove();
128129
});
129130

131+
// TODO: why isn't click unbound here?
130132
target.unbind( "mouseleave.tooltip blur.tooltip" );
131133

132134
this._trigger( "close", event );
@@ -149,7 +151,7 @@ $.widget("ui.tooltip", {
149151

150152
_find: function( target ) {
151153
var id = target.attr( "aria-describedby" );
152-
return id ? $( document.getElementById( id ) ) : $();
154+
return id ? $( "#" + id ) : $();
153155
}
154156
});
155157

0 commit comments

Comments
 (0)