-
Notifications
You must be signed in to change notification settings - Fork 28
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
Escaping of Tag Content #12
Comments
This isn't a bug in crate. The google-closure createTextNode is not escaping the text either, it's a plain wrapper over the Document createTextNode(). The latter method does not interpret or parse it's input, which is why HTML entity characters are printed literally. What to do? Since this question was posted 5 months ago, I gather you've found a solution. In any case, if you're working with UTF-8 encoded documents, send the equivalent unicode notation for the HTML entity, e.g. &ldquo -> \u201C ... |
This threw me too. It's because crate returns dom nodes instead of strings like hiccup. It uses createTextNode to do this. Conveniently, it accepts dom nodes as node content so you can do stuff like this: (crate/html [:div (.htmlToDocumentFragment goog.dom "<span>foo</span><strong>bar</strong>")])
=> <div><span>foo</span><strong>bar</strong></div> |
Haven't touched or looked at this in a long time, closing. |
I believe in Hiccup the content portion of tags is not HTML-escaped by default. In Crate, when I provide a string with raw HTML inside it, it appears that the Google methods used by Crate
createTextNode
and/orsetTextContent
do escape the content string.I need to be able to pass raw HTML strings as the content to elements. How can I go about this using Crate?
The text was updated successfully, but these errors were encountered: