Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Stache templates - HTML entities in attributes not handled properly

$
0
0
Hi all,

I think there's a bug in the way can.stache handles HTML entities in attributes.
Example:

  1. var s = '<span title="Next &gt;">Next &gt;</span>';
  2. var t1 = can.mustache(s)({}).childNodes[0];
  3. alert(t1.innerText); // "Next >" - correct
  4. alert(t1.getAttribute("title")); // "Next >" - correct
  5. var t2 = can.stache(s)({}).childNodes[0];
  6. alert(t2.innerText); // "Next >" - correct
  7. alert(t2.getAttribute("title")); // "Next &gt;" - incorrect
I can patch HTMLParser.parseAttrs() to do HTML decoding prior to calling handler.attrValue(chars), but I'm not sure this is the correct solution, and would rather have this fixed officially.

Best regards,
Boris.




Viewing all articles
Browse latest Browse all 3491

Trending Articles