How does HTML tags work inside script tag?

后端 未结 2 433
自闭症患者
自闭症患者 2020-12-02 17:17

For example, view-source at Joel Spolsky\'s public career profile



        
2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-02 17:55

    The key is in the script's type attribute. By setting it to type="text/html" it doesn't get run by the browser's JavaScript engine. Instead it is used for other things, such as templating. This example appears to be using these tags for templates.

    Check out this MIX 2011 webcast that shows how something similar is used in Knockout.js:

    http://channel9.msdn.com/events/mix/mix11/FRM08

提交回复
热议问题