Hi,

I'm using Sablono and Hickory in an Om app where I insert a lot of
existing html stored on the server, which is why I started using
Sablono rather than Om's dom.  

My problem is that > and < are bleeding through to the browser.

Here is a typical use (with the following in :require)

[sablono.core :as html :refer-macros [html]]
[hickory.core :as hk]

(html (map hk/as-hiccup (hk/parse-fragment "<p>text &gt;</p>")))

In the browser, the paragraph element is rendered correctly, but the
&gt; ends up in the DOM as &amp;gt;. 

After poking around a lot, it appears the problem is that the Hickory
as-hiccup function escapes text
content. (see 
https://github.com/davidsantiago/hickory/blob/12e52433cb60a31f75647fc68611804fc624fd3c/src/hickory/core.cljs#L95
 )
This is logical behavior, since the hiccup library itself doesn't
appear to do any escaping, so sending it pre-escaped text content
makes sense.

However, Sablono (or React?) seems to expect unescaped text, hence the
double-escaping. If I write literal hiccup in my cljs app and pass it
to sablono, I get the correct escaping in the browser.

At this point I'm not sure what do. This is neither a bug in Sablono,
nor in Hickory, but a mismatch between the two. I could walk the
hickory output and unescape all the text nodes, but this seems like it
should not be necessary. Try Kioo instead of Sablono?

Thanks for any suggestions.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to