When is a CDATA section necessary within a script tag?

后端 未结 15 2266
时光说笑
时光说笑 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:19

    When browsers treat the markup as XML:

    
    

    When browsers treat the markup as HTML:

    
    

    When browsers treat the markup as HTML and you want your XHTML 1.0 markup (for example) to validate.

    
    

提交回复
热议问题