I'm pretty sure <![CDATA[...]]>
sections can be used in XHTML5, but what about HTML5?
I'm pretty sure <![CDATA[...]]>
sections can be used in XHTML5, but what about HTML5?
The CDATA
structure isn't really for HTML at all, it's for XML.
People sometimes use them in XHTML inside script
tags because it removes the need for them to escape <
, >
and &
characters. It's unnecessary in HTML though, since script
tags in HTML are already parsed like CDATA sections.
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 :-)