@@ -50,16 +50,20 @@ $.widget( "ui.tooltip", {
50
50
} ,
51
51
52
52
open : function ( event ) {
53
- var target = $ ( event ? event . target : this . element ) . closest ( this . options . items ) ;
53
+ var content ,
54
+ that = this ,
55
+ target = $ ( event ? event . target : this . element )
56
+ . closest ( this . options . items ) ;
57
+
54
58
if ( ! target . length ) {
55
59
return ;
56
60
}
57
61
58
- var that = this ;
59
62
if ( ! target . data ( "tooltip-title" ) ) {
60
63
target . data ( "tooltip-title" , target . attr ( "title" ) ) ;
61
64
}
62
- var content = this . options . content . call ( target [ 0 ] , function ( response ) {
65
+
66
+ content = this . options . content . call ( target [ 0 ] , function ( response ) {
63
67
// IE may instantly serve a cached response for ajax requests
64
68
// delay this call to _open so the other call to _open runs first
65
69
setTimeout ( function ( ) {
@@ -112,14 +116,15 @@ $.widget( "ui.tooltip", {
112
116
113
117
close : function ( event ) {
114
118
var that = this ,
115
- target = $ ( event ? event . currentTarget : this . element ) ;
119
+ target = $ ( event ? event . currentTarget : this . element ) ,
120
+ tooltip = this . _find ( target ) ;
121
+
116
122
target . attr ( "title" , target . data ( "tooltip-title" ) ) ;
117
123
118
124
if ( this . options . disabled ) {
119
125
return ;
120
126
}
121
127
122
- var tooltip = this . _find ( target ) ;
123
128
target . removeAttr ( "aria-describedby" ) ;
124
129
125
130
tooltip . stop ( true ) ;
@@ -136,12 +141,12 @@ $.widget( "ui.tooltip", {
136
141
_tooltip : function ( ) {
137
142
var id = "ui-tooltip-" + increments ++ ,
138
143
tooltip = $ ( "<div>" )
139
- . attr ( {
140
- id : id ,
141
- role : "tooltip"
142
- } )
143
- . addClass ( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
144
- ( this . options . tooltipClass || "" ) ) ;
144
+ . attr ( {
145
+ id : id ,
146
+ role : "tooltip"
147
+ } )
148
+ . addClass ( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
149
+ ( this . options . tooltipClass || "" ) ) ;
145
150
$ ( "<div>" )
146
151
. addClass ( "ui-tooltip-content" )
147
152
. appendTo ( tooltip ) ;
0 commit comments