mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Tooltip: Allow strings for content option.
This commit is contained in:
parent
dee7c8bd44
commit
e242868f56
@ -65,6 +65,16 @@ test( "content: change while open", function() {
|
||||
element.tooltip( "open" );
|
||||
});
|
||||
|
||||
test( "content: string", function() {
|
||||
expect( 1 );
|
||||
var element = $( "#tooltipped1" ).tooltip({
|
||||
content: "just a string",
|
||||
open: function( event, ui ) {
|
||||
equal( ui.tooltip.text(), "just a string" );
|
||||
}
|
||||
}).tooltip( "open" );
|
||||
});
|
||||
|
||||
test( "items", function() {
|
||||
expect( 2 );
|
||||
var event,
|
||||
|
7
ui/jquery.ui.tooltip.js
vendored
7
ui/jquery.ui.tooltip.js
vendored
@ -152,9 +152,14 @@ $.widget( "ui.tooltip", {
|
||||
|
||||
_updateContent: function( target, event ) {
|
||||
var content,
|
||||
contentOption = this.options.content,
|
||||
that = this;
|
||||
|
||||
content = this.options.content.call( target[0], function( response ) {
|
||||
if ( typeof contentOption === "string" ) {
|
||||
return this._open( event, target, contentOption );
|
||||
}
|
||||
|
||||
content = contentOption.call( target[0], function( response ) {
|
||||
// ignore async response if tooltip was closed already
|
||||
if ( !target.data( "tooltip-open" ) ) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user