The plugins site is currently in development.
We've been looking to provide a higher-quality, spam-free experience at the plugins site for some time, and a major error on our part forced us to shut down the current site before we could put the new one in place. We are developing a new site, and you can follow along with its development on GitHub. For more information about this transition, including steps you can take as a plugin author to prepare, please read our post about what's going on.
Allow the title to be HTML escaped
| Project: | clueTip - flexible, enhanced tooltip |
| Version: | 0.9.8 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
At the moment, if the source element attribute title contains HTML markup, the cluetip title contains the markup.
e.g.
title="<b>I am bold</b>"
results in a cluetip title of "I am bold" in bold.
However, if cluetip is not enabled, the same title in a browser (e.g. Firefox) displays as "<b>I am bold</b>".
I'd like to be able to tell cluetip that the title should be escaped of any markup so the browser native title and the cluetip title return with the same text.
The following patch adds an 'escapeTitle' attribute to do just that:
Index: jquery.cluetip.js
===================================================================
--- jquery.cluetip.js (revision 1671)
+++ jquery.cluetip.js (working copy)
@@ -120,6 +120,9 @@
tipParts = tipTitle.split(opts.splitTitle);
tipTitle = tipParts.shift();
}
+ if (opts.escapeTitle) {
+ tipTitle = tipTitle.replace(/&/g,'&').replace(/>/g,'>').replace(/</g,'<');
+ }
var localContent;
/***************************************
@@ -475,6 +478,7 @@
closePosition: 'top', // location of close text for sticky cluetips; can be 'top' or 'bottom' or 'title'
closeText: 'Close', // text (or HTML) to to be clicked to close sticky clueTips
truncate: 0, // number of characters to truncate clueTip's contents. if 0, no truncation occurs
+ escapeTitle: false, // whether to html escape the title attribute
// effect and speed for opening clueTips
fx: {
Without this, the title attribute must be double HTML escaped, which results in an incorrect native tooltip, or a title attribute must be provided and a title attribute specifically for cluetip, which is a duplication of effort.
cheers
vittal
- Login to post comments

Comments
#1
thanks for the suggestion and the patch. I've updated the plugin at GitHub:
http://github.com/kswedberg/jquery-cluetip/tree/master
It'll be in the next release here as well. thanks again.
#2
Automatically closed -- issue fixed for two weeks with no activity.