views:

151

answers:

2

I'm pretty sure the <![CDATA[ tags need to be used in XHTML5, but what about HTML5? Or correct me if I don't need to use them in either?

+2  A: 

Perhaps see: http://wiki.whatwg.org/wiki/HTML_vs._XHTML

<![CDATA[...]]> is a a bogus comment.

In HTML, <script> is already protected -- this is why sometimes it must be written as a = "</scri" + "pt>", to avoid confusing the browser. Note that the code is valid outside a CDATA in HTML.

pst
+9  A: 

The CDATA structure isn't really for HTML at all, it's for XML. People sometimes use them in HTML inside script tags because it removes the need for them to escape certain special characters. It's by no means a requirement in either HTML 4 or 5, though.

Edit: This is where we open that really mouldy old can of worms from 2002 over whether you're sending XHTML as text/html or as application/xhtml+xml like you're 'supposed' to :-)

hollsk
I am sending HTML (not XHTML) and I want that. Thxs for the answer :)
Darryl Hein