3
这工作正常(我可以通过ID访问片段在DOM)为客户端模板使用脚本标记,为什么我不能通过src属性加载?
<script type="text/x-template" id="todo-item-template">
<div class="todo-view">
{blah} {blah}
</div>
</script>
,但如果我把模板存储在外部资源,我不能在DOM中找到它:
<script type="text/x-template" id="todo-item-template" src="todo-item-template.html">
铬是给我的,我认为是不相关的警告:
Resource interpreted as Script but transferred with MIME type text/html:
"http://localhost:8000/todo2/todo-stats-template.html".
我从文件系统运行,和/或从python -m SimpleHTTPServer
。有任何想法吗?
即使你*通过src'引用它,你将如何访问内容?它不会成为节点的'textContent'。 –