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

replacement of < and > with &lt; and &gt; #110

Closed
amper5and opened this issue Aug 5, 2011 · 5 comments
Closed

replacement of < and > with &lt; and &gt; #110

amper5and opened this issue Aug 5, 2011 · 5 comments

Comments

@amper5and
Copy link

Some of my data objects use ready HTML with regular tags surrounded by "<" and ">" . Mustache.js converts these to &lt; and &gt;. Doing a String.replace(/&gt;/g,'>').replace(/&lt;/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?

@thedufer
Copy link

thedufer commented Aug 8, 2011

Outputting data with {{data}} (double mustache) always escapes html characters. Use {{{data}}} (triple mustache) if you don't want it escaped.

@amper5and
Copy link
Author

oh, cool! I didn't know that. thanks, thedufer.

@bobthecow
Copy link

@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 :)

@thedufer
Copy link

thedufer commented Aug 8, 2011

Also, I believe the syntax {{&data}} is equivalent, although I've never used it.

@githubwangxu
Copy link

that cool👍!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants