By setting the type to "text/template", it's not a script that the browser can understand, and so the browser will simply ignore it. This allows you to put anything in there, which can then be extracted later and used by a templating library to generate HTML snippets.
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 <script type="text/template"...
By setting the type to "text/template", it's not a script that the browser can understand, and so the browser will simply ignore it. This allows you to put anything in there, which can then be extracted later and used by a templating library to generate HTML snippets.
yamadar のブックマーク 2014/04/01 15:03
このブックマークにはスターがありません。
最初のスターをつけてみよう!
Explanation of <script type = "text/template"> ... </script>
stackoverflow.com2013/06/24
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 <script type="text/template"...
2 人がブックマーク・2 件のコメント
\ コメントが サクサク読める アプリです /