[suggestion] Allow handlebars templates to be wrapped in comments #315

BrynCooke opened this Issue Sep 17, 2012 · 2 comments


None yet
2 participants

One of the things that caught me out when starting with ember.js is that you cannot embed certain types of handlebars templates in an XHTML document, I guess this is the rational behind the interesting doctype in the starter kit. Using a standard doctype or supplying an xhtml content header will cause the browser to try to validate the page and declare it invalid. For example:

<script type="text/x-handlebars" data-template-name="say-hello">
        <a href="#" {{action "edit" on="click"}}>Edit</a> <!--Cannot parse attribute name (Chrome)-->

This is a pain because there are many frameworks that it would be great to integrate ember with where changing the output doc type is not feasible.

If the handlebars templates could be wrapped in comments then it would solve these issues:

<script type="text/x-handlebars" data-template-name="say-hello">
<!--        <a href="#" {{action "edit" on="click"}}>Edit</a>-->

It looks like it is possible to get the comments from the DOM, but this is not supported natively by jQuery

BTW: If this is likely to get accepted then I'd be willing to write a patch :).

@BrynCooke BrynCooke closed this Sep 18, 2012

@BrynCooke BrynCooke reopened this Sep 18, 2012


kpdecker commented Apr 7, 2013

The handlebars library doesn't do any sort of loading logic. This seems like something that should be implemented by whatever other code is inputting data to the compile call. I would raise this issue with the ember project. That or switch to html5 doctype :)

@kpdecker kpdecker closed this Apr 7, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment