@@ -73,13 +73,22 @@ $.widget( "ui.tooltip", {
73
73
} ,
74
74
75
75
_setOption : function ( key , value ) {
76
+ var that = this ;
77
+
76
78
if ( key === "disabled" ) {
77
79
this [ value ? "_disable" : "_enable" ] ( ) ;
78
80
this . options [ key ] = value ;
79
81
// disable element style changes
80
82
return ;
81
83
}
84
+
82
85
this . _super ( key , value ) ;
86
+
87
+ if ( key === "content" ) {
88
+ $ . each ( this . tooltips , function ( id , element ) {
89
+ that . _updateContent ( element ) ;
90
+ } ) ;
91
+ }
83
92
} ,
84
93
85
94
_disable : function ( ) {
@@ -114,9 +123,7 @@ $.widget( "ui.tooltip", {
114
123
} ,
115
124
116
125
open : function ( event ) {
117
- var content ,
118
- that = this ,
119
- target = $ ( event ? event . target : this . element )
126
+ var target = $ ( event ? event . target : this . element )
120
127
. closest ( this . options . items ) ;
121
128
122
129
// No element to show a tooltip for
@@ -140,19 +147,26 @@ $.widget( "ui.tooltip", {
140
147
141
148
target . data ( "tooltip-open" , true ) ;
142
149
150
+ this . _updateContent ( target , event ) ;
151
+ } ,
152
+
153
+ _updateContent : function ( target , event ) {
154
+ var content ,
155
+ that = this ;
156
+
143
157
content = this . options . content . call ( target [ 0 ] , function ( response ) {
144
158
// ignore async response if tooltip was closed already
145
159
if ( ! target . data ( "tooltip-open" ) ) {
146
160
return ;
147
161
}
148
162
// IE may instantly serve a cached response for ajax requests
149
163
// delay this call to _open so the other call to _open runs first
150
- setTimeout ( function ( ) {
151
- that . _open ( event , target , response ) ;
152
- } , 1 ) ;
164
+ that . _delay ( function ( ) {
165
+ this . _open ( event , target , response ) ;
166
+ } ) ;
153
167
} ) ;
154
168
if ( content ) {
155
- that . _open ( event , target , content ) ;
169
+ this . _open ( event , target , content ) ;
156
170
}
157
171
} ,
158
172
0 commit comments