[Seaside-dev] Make use of CDATA wrapping optional?

Philippe Marschall philippe.marschall at gmail.com
Mon Apr 14 08:08:45 UTC 2014


On Sun, Apr 13, 2014 at 6:06 PM, Johan Brichau <johan at inceptive.be> wrote:
> Hi there,
>
> The contents of script tags generated in Seaside are by-default wrapped with CDATA tags.
> This used to be required to generate valid xhtml [1].

It's a clever hack from the time when "in the future everybody  is
going to use XHTML". The problem is that in HTML and XHTML the
semantics of the content of <script> tags are different. The comment &
CDATA trick gives us the same semantics in HTML and XHTML (as long as
you don't have ]]> in your scripts).

> In html5, they can be used but they can also be safely omitted [2] (which is generally the preferred way in html5).
>
> When using a framework like React.js with JSX templates [3], it is even required to omit the CDATA tag.
> The comments inside the script are interpreted by the framework and it does not seem to handle it well when there is the CDATA tag.

That sounds like a bug in react.

> As I'm experimenting with a React wrapper for Seaside and I am wondering what the best strategy can be:
> - omit CDATA for all script tags being generated on an html5 document
> - allow to specifically omit the CDATA tag on a script tag
> - inversely: allow to enforce the CDATA tag on a script tag
>
> My preference would be that Seaside automatically omits the CDATA tag when it's in html5 mode (which is the default mode since 3.1), with an option to turn it on for a specific script.
> Any thoughts?

I don't know if anybody ever used XHTML and served it in a way to be
parsed as XML. I don't think anybody will in the future. So it may be
best to just get rid of this clever hack..

Cheers
Philippe


More information about the seaside-dev mailing list