Some of my data objects use ready HTML with regular tags surrounded by "<" and ">" . Mustache.js converts these to <
and >
. Doing a String.replace(/>/g,'>').replace(/</g,'<')
on the resultant output introduces a lot of lag.
Is this is expected behavior? Can it be changed to preserve the <'s and >'s? Should these symbols be escaped somehow?
Outputting data with {{data}}
(double mustache) always escapes html characters. Use {{{data}}}
(triple mustache) if you don't want it escaped.
oh, cool! I didn't know that. thanks, thedufer.
@amper5and: Note that if you use {{{ data }}}
it's _your_ responsibility to make sure you're not creating XSS or CSRF vulnerabilities, as you're bypassing the mechanism designed to prevent that :)
Also, I believe the syntax {{&data}}
is equivalent, although I've never used it.
that cool👍!!!
Most helpful comment
Outputting data with
{{data}}
(double mustache) always escapes html characters. Use{{{data}}}
(triple mustache) if you don't want it escaped.