我应该使用<![CDATA [...]]>在HTML5中? [英] Should I use <![CDATA[...]]> in HTML5?
问题描述
我非常确定<![CDATA [...]]>
部分可用于XHTML5,但HTML5又如何?
CDATA
结构根本不适用于HTML,而是适用于XML。
人们有时会在脚本
标签内的HTML中使用它们,因为它不需要它们转义某些特殊字符。这绝不是一个要求,但(对于HTML 4或5)。
编辑:这是我们打开真正发霉的旧从2002年开始,您可以将XHTML作为 text / html
或 application / xhtml + xml
发送你应该: - )
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 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 :-)
这篇关于我应该使用<![CDATA [...]]>在HTML5中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!