Why use \x3C instead of < when generating HTML from JavaScript?

后端 未结 2 870
攒了一身酷
攒了一身酷 2020-12-13 00:35

I see the following HTML code used a lot to load jQuery from a content delivery network, but fall back to a local copy if the CDN is unavailable (e.g. in the Modernizr docs)

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 01:07

    Some parsers handle the < version as the closing tag and interpret the code as

    
    

    \x3C is hexadecimal for <. Those are interchangable within the script.

提交回复
热议问题