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 :-)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…