From 84e0ce168f109fbd5482c6c1ba09bbbb55592888 Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Thu, 15 Apr 2010 09:45:35 +0200 Subject: Tooltip: Unit tests for tooltip and a fix to pass through event objects to triggered events --- ui/jquery.ui.tooltip.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'ui') diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 166bff407..13c809f45 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -49,10 +49,10 @@ $.widget("ui.tooltip", { this.opacity = this.tooltip.css("opacity"); this.element .bind("focus.tooltip mouseenter.tooltip", function(event) { - self.open(); + self.open( event ); }) .bind("blur.tooltip mouseleave.tooltip", function(event) { - self.close(); + self.close( event ); }); }, @@ -73,7 +73,7 @@ $.widget("ui.tooltip", { return this.tooltip; }, - open: function() { + open: function(event) { var target = this.element; // already visible? possible when both focus and mouseover events occur if (this.current && this.current[0] == target[0]) @@ -84,14 +84,14 @@ $.widget("ui.tooltip", { var content = this.options.content.call(target[0], function(response) { // ignore async responses that come in after the tooltip is already hidden if (self.current == target) - self._show(target, response); + self._show(event, target, response); }); if (content) { - self._show(target, content); + self._show(event, target, content); } }, - _show: function(target, content) { + _show: function(event, target, content) { if (!content) return; @@ -116,10 +116,10 @@ $.widget("ui.tooltip", { else this.tooltip.is(':visible') ? this.tooltip.fadeTo("normal", this.opacity) : this.tooltip.fadeIn(); - this._trigger( "open" ); + this._trigger( "open", event ); }, - close: function() { + close: function(event) { if (!this.current) return; @@ -137,7 +137,7 @@ $.widget("ui.tooltip", { else this.tooltip.stop().fadeOut(); - this._trigger( "close" ); + this._trigger( "close", event ); } }); -- cgit v1.2.3