Explanation of [removed] … [removed]

前端 未结 7 979
隐瞒了意图╮
隐瞒了意图╮ 2020-11-22 10:05

I just stumbled upon something I\'ve never seen before. In the source of Backbone.js\'s example TODO application (Backbone TODO Example) they had their templates inside a

7条回答
  •  情歌与酒
    2020-11-22 10:37

    By setting script tag type other than text/javascript, browser will not execute the internal code of script tag. This is called micro template. This concept is widely used in Single page application(aka SPA).

    
    

    For micro template, type of the script tag is text/template. It is very well explained by Jquery creator John Resig http://ejohn.org/blog/javascript-micro-templating/

提交回复
热议问题