We have some custom JS scripts to deal with tooltip which are put in a dom attribute (tooltip) when we render the page.
however when i try to retrieve this tooltips (displayed as divs) string javaScript seems to automatically unescape the attribute value. is this normal behavior? and is there a way to avoid this?
The problem i have is that <email@example.org> turn into (invalid) html.
example for reproduction:
<div tltip ="<text>" id="escaped" />
<div tltip ="<text>"id="notescaped" />
js:
a = document.getElementById("escaped").getAttribute("tooltip");
b = document.getElementById("notescaped").getAttribute("tooltip");
a.match("<"); //returns true (unexpected)
a.match("<"); //returns true (expected)
a == b; // returns true (unexpected)
edit:
to clarify im trying to display a (div) tooltip where i would like to somehow read content such as:
"<b> <email@example.com> <\b>"
from the dom and display it in a div where it should look like: "<email@example.org>"