btw, a bigger issue (but one I'm too scared to touch) is that Wicket by default uses "text/html" as MIME type and according to the WHATWG wiki , CDATA has *no* effect at all unless you use an XML MIME type (application/xml or text/xhtml+xml):

https://wiki.whatwg.org/wiki/HTML_vs._XHTML

Not sure how up-to-date this wiki page really is and whether current browser implementations agree with what the page says (I didn't check this) ... but this would mean that the whole "<![CDATA[" stuff could most likely be dropped from JavascriptUtils , at least if one only cares about modern browsers.

Cheers,
Tobias

Hi Sven,

Thanks for your response! After reading a very informative blog post by one of the Chrome DevTools developers (https://mathiasbynens.be/notes/etago), I learned there is certain content that is perfectly fine in pure Javascript but literally *impossible* to include using an inline <script/> tag, simply because there's no way to escape stuff properly.

So despite my earlier post, I now think what JavascriptUtils#writeJavaScript() does is actually correct - there's simply no way to do any better.



Reply via email to