When is a CDATA section necessary within a script tag?

后端 未结 15 2311
时光说笑
时光说笑 2020-11-21 22:37

Are CDATA tags ever necessary in script tags and if so when?

In other words, when and where is this:



        
15条回答
  •  自闭症患者
    2020-11-21 23:06

    CDATA is necessary in any XML dialect, because text within an XML node is treated as a child element before being evaluated as JavaScript. This is also the reason why JSLint complains about the < character in regexes.

    References

    • Creating a declarative XML UI language
    • The Future of the Web: Rich Clients, Rich Browsers, Rich Portals

提交回复
热议问题