Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
BrynCooke opened this Issue · 2 comments

2 participants

@BrynCooke

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)-->
</script>

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>-->
</script>

It looks like it is possible to get the comments from the DOM, but this is not supported natively by jQuery
http://www.bennadel.com/blog/1563-jQuery-Comments-Plug-in-To-Access-HTML-Comments-For-DOM-Templating.htm

@BrynCooke

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

@BrynCooke BrynCooke closed this
@BrynCooke BrynCooke reopened this
@kpdecker
Collaborator

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.