【发布时间】:2012-09-15 22:49:13
【问题描述】:
我刚刚开始查看 Ember.js,但遇到了包含模板化属性的车把模板的问题:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" />
<script type="text/javascript" src="js/handlebars-1.0.0.beta.6.js" />
<script type="text/javascript" src="js/ember-1.0.pre.js" />
<script type="text/x-handlebars" data-template-name="say-hello">
<p>First name: {{name.firstName}}</p>
<p>Last name: {{name.lastName}}</p>
<p>Last full: {{name.fullName}}</p>
<a href="#" {{action "edit" on="click"}}>Edit</a>
</script>
</head>
<body>
<h2>Hello World!</h2>
</body>
</html>
我在 Chrome 中遇到错误:
This page contains the following errors:
error on line 14 at column 10: error parsing attribute name
Below is a rendering of the page up to the first error.
我在 Firefox 中也遇到错误。
我猜这是浏览器试图验证文档,有什么办法可以避免这种情况并仍然保留文档类型?
【问题讨论】:
-
嘿,我也是 ember 新手。我认为这个错误与 doctype 没有任何关系。你在“say-hello”模板中有什么代码?