Tooltip: Avoid errors on mouseover of tooltips with parents that have no title attribute. Fixes #8955 - Tooltip: error when parent element has no title attribute using jQuery <1.7

This corrects a failing test with core 1.6, so no new test is required.
This commit is contained in:
Mike Sherov 2013-01-10 21:02:28 -05:00
parent 83cbf97978
commit e4a786e1a4

View File

@ -46,7 +46,9 @@ $.widget( "ui.tooltip", {
version: "@VERSION", version: "@VERSION",
options: { options: {
content: function() { content: function() {
var title = $( this ).attr( "title" ); // support: IE<9, Opera in jQuery <1.7
// .text() can't accept undefined, so coerce to a string
var title = $( this ).attr( "title" ) || "";
// Escape title, since we're going from an attribute to raw HTML // Escape title, since we're going from an attribute to raw HTML
return $( "<a>" ).text( title ).html(); return $( "<a>" ).text( title ).html();
}, },