What exactly is CDATA and what does it do?

前端 未结 4 507
予麋鹿
予麋鹿 2021-01-04 08:58

I sometimes notice a CSS or JS code surrounded with and ]]> tags. I couldn\'t find any explanation to this. What does CDATA do? Why

4条回答
  •  滥情空心
    2021-01-04 09:22

    It tells the interpreter that it should not try to interpret the data enclosed in the tags. For example, if you want a XML file to contain a comment with < or >, XML interpreters will report the file as invalid because the caracters < and > will not be part of standard tag. You simply have to surround the code with the CDATA tags.

提交回复
热议问题