I use a tooltip library where I escape HTML and place it in the title attribute. When you mouse over that element, it unescapes the HTML and places it in the tooltip.
The issues I'm having is recursion. I have a button in a tooltip, that also has a tooltip. Ex:
nested_toooltip = "<h1>Hi, I'm a tooltip</h1>"
tooltip = '<a title="' + escapeHtml(nested_tooltip) + '">Button</a>"
document.write('<a title="' + escapeHtml(tooltip) + '">Button</a>"')
When you create the first tooltip, it unescapes ALL of the tooltips. And I essentially get malformed HTML. Is there a clever way to do this where HTML can essentially be escaped twice? Because escapeHtml(escapeHtml(string)) produces the same result as escapeHtml(string).