diff --git a/.gitignore b/.gitignore index 23d9dd00058..918e206168a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ docs *.patch .DS_Store .settings +*.sw? diff --git a/tests/unit/tooltip/tooltip_options.js b/tests/unit/tooltip/tooltip_options.js index 01ac2504088..0b0043bfaad 100644 --- a/tests/unit/tooltip/tooltip_options.js +++ b/tests/unit/tooltip/tooltip_options.js @@ -97,6 +97,32 @@ test( "content: string", function() { }).tooltip( "open" ); }); +test( "content: element", function() { + expect( 1 ); + var content = "
This is a test of the emergency broadcast system.
" + var element = $( content )[ 0 ]; + $( "#tooltipped1" ).tooltip({ + content: element, + open: function( event, ui ) { + // Getting just the contents of the tooltip wrapper. + equal( ui.tooltip[ 0 ].firstChild.innerHTML, content ); + } + }).tooltip( "open" ); +}); + +test( "content: jQuery", function() { + expect( 1 ); + var content = "This is a test of the emergency broadcast system.
" + var element = $( content ); + $( "#tooltipped1" ).tooltip({ + content: element, + open: function( event, ui ) { + console.log( ui.tooltip ); + equal( ui.tooltip[ 0 ].firstChild.innerHTML, content ); + } + }).tooltip( "open" ); +}); + test( "items", function() { expect( 2 ); var event, diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 5df93a00245..e516b01baab 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -183,7 +183,7 @@ $.widget( "ui.tooltip", { that = this, eventType = event ? event.type : null; - if ( typeof contentOption === "string" ) { + if ( typeof contentOption === "string" || contentOption.nodeType || contentOption.jquery ) { return this._open( event, target, contentOption ); }