diff --git a/tests/unit/tooltip/tooltip_options.js b/tests/unit/tooltip/tooltip_options.js index 17f0a423775..2d49533f24f 100644 --- a/tests/unit/tooltip/tooltip_options.js +++ b/tests/unit/tooltip/tooltip_options.js @@ -100,6 +100,30 @@ test( "content: string", function() { }).tooltip( "open" ); }); +test( "content: element", function() { + expect( 1 ); + var content = "
this is a test of the emergency broadcast system.
", + element = $( content )[ 0 ]; + $( "#tooltipped1" ).tooltip({ + content: element, + open: function( event, ui ) { + equal( ui.tooltip.children().html().toLowerCase(), content ); + } + }).tooltip( "open" ); +}); + +test( "content: jQuery", function() { + expect( 1 ); + var content = "this is a test of the emergency broadcast system.
", + element = $( content ); + $( "#tooltipped1" ).tooltip({ + content: element, + open: function( event, ui ) { + equal( ui.tooltip.children().html().toLowerCase(), content ); + } + }).tooltip( "open" ); +}); + test( "items", function() { expect( 2 ); var event, diff --git a/ui/tooltip.js b/ui/tooltip.js index 7ea1d13ee80..85c64f2a091 100644 --- a/ui/tooltip.js +++ b/ui/tooltip.js @@ -208,7 +208,8 @@ return $.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 ); } @@ -276,13 +277,9 @@ return $.widget( "ui.tooltip", { // JAWS announces deletions even when aria-relevant="additions" // Voiceover will sometimes re-read the entire log region's contents from the beginning this.liveRegion.children().hide(); - if ( content.clone ) { - a11yContent = content.clone(); - a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" ); - } else { - a11yContent = content; - } - $( "