From d43118dfbab9591caa5181a9e50608921d19bd5b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Sat, 28 May 2011 11:43:57 -0400 Subject: [PATCH] Tooltip: Cleanup. --- ui/jquery.ui.tooltip.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index c0aaa4fbe..756fe0f7b 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -16,7 +16,7 @@ var increments = 0; -$.widget("ui.tooltip", { +$.widget( "ui.tooltip", { options: { tooltipClass: null, items: "[title]", @@ -56,7 +56,8 @@ $.widget("ui.tooltip", { target.data( "tooltip-title", target.attr( "title" ) ); } 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() { // when undefined, it got removeAttr, then ignore (ajax response) // initially its an empty string, so not undefined @@ -64,7 +65,7 @@ $.widget("ui.tooltip", { if ( target.attr( "aria-describedby" ) !== undefined ) { that._open( event, target, response ); } - }, 13 ); + }, 1 ); }); if ( content ) { that._open( event, target, content ); @@ -127,6 +128,7 @@ $.widget("ui.tooltip", { $( this ).remove(); }); + // TODO: why isn't click unbound here? target.unbind( "mouseleave.tooltip blur.tooltip" ); this._trigger( "close", event ); @@ -149,7 +151,7 @@ $.widget("ui.tooltip", { _find: function( target ) { var id = target.attr( "aria-describedby" ); - return id ? $( document.getElementById( id ) ) : $(); + return id ? $( "#" + id ) : $(); } }); -- 2.39.5