Tooltip: Cleanup.

This commit is contained in:
Scott González 2011-05-28 11:43:57 -04:00
parent d4f6f17c8d
commit d43118dfba

View File

@ -56,7 +56,8 @@ $.widget("ui.tooltip", {
target.data( "tooltip-title", target.attr( "title" ) ); target.data( "tooltip-title", target.attr( "title" ) );
} }
var content = this.options.content.call( target[0], function( response ) { var content = this.options.content.call( target[0], function( response ) {
// IE may instantly serve a cached response, need to give it a chance to finish with _open before that // IE may instantly serve a cached response for ajax requests
// delay this call to _open so the other call to _open runs first
setTimeout(function() { setTimeout(function() {
// when undefined, it got removeAttr, then ignore (ajax response) // when undefined, it got removeAttr, then ignore (ajax response)
// initially its an empty string, so not undefined // initially its an empty string, so not undefined
@ -64,7 +65,7 @@ $.widget("ui.tooltip", {
if ( target.attr( "aria-describedby" ) !== undefined ) { if ( target.attr( "aria-describedby" ) !== undefined ) {
that._open( event, target, response ); that._open( event, target, response );
} }
}, 13 ); }, 1 );
}); });
if ( content ) { if ( content ) {
that._open( event, target, content ); that._open( event, target, content );
@ -127,6 +128,7 @@ $.widget("ui.tooltip", {
$( this ).remove(); $( this ).remove();
}); });
// TODO: why isn't click unbound here?
target.unbind( "mouseleave.tooltip blur.tooltip" ); target.unbind( "mouseleave.tooltip blur.tooltip" );
this._trigger( "close", event ); this._trigger( "close", event );
@ -149,7 +151,7 @@ $.widget("ui.tooltip", {
_find: function( target ) { _find: function( target ) {
var id = target.attr( "aria-describedby" ); var id = target.attr( "aria-describedby" );
return id ? $( document.getElementById( id ) ) : $(); return id ? $( "#" + id ) : $();
} }
}); });