Skip to content
Browse files
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.
  • Loading branch information
mikesherov committed Jan 11, 2013
1 parent 83cbf97 commit e4a786e1a4fdd85b391711688bcb9790f38b5352
Showing 1 changed file with 3 additions and 1 deletion.
@@ -46,7 +46,9 @@ $.widget( "ui.tooltip", {
version: "@VERSION",
options: {
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
return $( "<a>" ).text( title ).html();

1 comment on commit e4a786e

Copy link

@Limos Limos commented on e4a786e Feb 5, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of .text() has broken the ability to include HTML markup within tooltips. Angle brackets are converted to their html equivalents so tooltips look like raw html. (Or is the subsequent call to html() supposed to convert back to HTML? I'm using jQuery 1.9.1.)

For now I'm simply using: return title;

Comments? Suggestions?

Please sign in to comment.