我刚刚开始查看 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 中也遇到错误。
我猜这是试图验证文档的浏览器,有没有办法避免这种情况并仍然保留文档类型?