Should I use <![CDATA[…]]> in HTML5?

前端 未结 4 669
傲寒
傲寒 2020-12-12 19:17

I\'m pretty sure sections can be used in XHTML5, but what about HTML5?

4条回答
  •  囚心锁ツ
    2020-12-12 20:13

    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, though (for either HTML 4 or 5).

    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 :-)

提交回复
热议问题