Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow escaping content #137

Open
JN-Jones opened this issue May 4, 2015 · 2 comments
Open

Allow escaping content #137

JN-Jones opened this issue May 4, 2015 · 2 comments
Labels
Feature Software improvements that involve implementing new features.

Comments

@JN-Jones
Copy link

JN-Jones commented May 4, 2015

I've a case where user input is used as tooltip. In the end I needed to overwrite the getTooltipContent function and changed return content to return escapeHTML(content) (escapeHTML exists already in my case). Would be nice if a simple option could be added.

@stevenbenner
Copy link
Owner

Properly escaping HTML in all scenarios can actually be tricky. See: jQuery's text() documentation

Due to variations in the HTML parsers in different browsers, the text returned may vary in newlines and other white space.

So I think that any HTML entities logic would be outside the scope of a humble little tooltip plugin.

However, it might make sense to provide an option to use .text() instead of .html() like it is doing today. I'm not sure how best to surface that option though.

@stevenbenner stevenbenner added the Feature Software improvements that involve implementing new features. label May 5, 2015
@JN-Jones
Copy link
Author

JN-Jones commented May 5, 2015

Probably a simple event/jhook in the getTooltipContent function? That way it'd be possible to easily modify the acctual content of the tooltip (eg escaping it, but also change other things).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Software improvements that involve implementing new features.
Projects
None yet
Development

No branches or pull requests

2 participants