Skip to content

Commit ebac971

Browse files
committed
Tooltip: Renamed show to open and open to _show (based on spec), changed trigger(show) to trigger(open) and added trigger(close); always use element as target, enabling programmatic opening and closing
1 parent 744343a commit ebac971

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

ui/jquery.ui.tooltip.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ $.widget("ui.tooltip", {
4949
this.opacity = this.tooltip.css("opacity");
5050
this.element
5151
.bind("focus.tooltip mouseenter.tooltip", function(event) {
52-
self.show($(event.target));
52+
self.open();
5353
})
5454
.bind("blur.tooltip mouseleave.tooltip", function(event) {
5555
self.close();
@@ -73,7 +73,8 @@ $.widget("ui.tooltip", {
7373
return this.tooltip;
7474
},
7575

76-
show: function(target) {
76+
open: function() {
77+
var target = this.element;
7778
// already visible? possible when both focus and mouseover events occur
7879
if (this.current && this.current[0] == target[0])
7980
return;
@@ -83,14 +84,14 @@ $.widget("ui.tooltip", {
8384
var content = this.options.content.call(target[0], function(response) {
8485
// ignore async responses that come in after the tooltip is already hidden
8586
if (self.current == target)
86-
self.open(target, response);
87+
self._show(target, response);
8788
});
8889
if (content) {
89-
self.open(target, content);
90+
self._show(target, content);
9091
}
9192
},
9293

93-
open: function(target, content) {
94+
_show: function(target, content) {
9495
if (!content)
9596
return;
9697

@@ -115,7 +116,7 @@ $.widget("ui.tooltip", {
115116
else
116117
this.tooltip.is(':visible') ? this.tooltip.fadeTo("normal", this.opacity) : this.tooltip.fadeIn();
117118

118-
this._trigger("show", null, { target: target });
119+
this._trigger( "open" );
119120
},
120121

121122
close: function() {
@@ -136,6 +137,7 @@ $.widget("ui.tooltip", {
136137
else
137138
this.tooltip.stop().fadeOut();
138139

140+
this._trigger( "close" );
139141
}
140142

141143
});

0 commit comments

Comments
 (0)