-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTML comments in handlebars templates cause error. #1580
Comments
I'm not 100% sure, but I think I've seen handlebars line comments, using {{! }}, could try it and tell if it works ? These are line comments in handlebars see: http://handlebarsjs.com/ |
Yes those work, no problem there. Its the case I noted, which isn't mentioned anywhere that I can find:
There is no documentation on that being a problem, and html comments are allowed in handlebars templates, so perhaps the fix is as easy as documenting that it will cause an error to be thrown if there are {{}} with it. |
@phpaddiction The issue is that Handlebars is not aware of its surrounding code. It doesn't know that it's inside of a comment so it sets up the binding infrastructure. The master version of Handlebars has support for block comments which long term are the best solution. You use them as such: |
Sounds like a comment for both emberjs and handlebars docs would be good enough. It was a couple hour time sink to figure out :). Perhaps a little more info in the debug version exception about this being a possible cause of the error *Cannot perform operations on a Metamorph that is not in the DOM. * This is what is on the handlebars site, nothing to lead me to think that it would be an issue.
Anyway, thanks for taking a look at this. |
@phpaddiction The Metamorph issue is specific to Ember. However, the blocks in HTML comments will still be processed in standard Handlebars unless they are wrapped in a block Handlebars comment. |
Makes sense, I haven't used handlebars outside Ember so I wasn't sure. I'm just happy there is a reason and I can avoid it now. |
Yeah, sorry for the trouble. Ideally we'd get a more useful error message. I'll see what we can do about it. |
fixed bug: emberjs/ember.js#1580 fixed bug: it could happen that the graph renderer tries to render without data fixed bug: it could happen that computing 3_days throws an error because a bridge has periods for 3_months, 1_year but not 1_week
I had temporarily commented out some html in a template. The commented out code contained a couple {{variables}} like this.
This causes the error *Cannot perform operations on a Metamorph that is not in the DOM. * this error happens when the view is disconnected from an outlet.
Not sure what the fix should be. I often comment out html while in development so I would say that it needs to be handled.
Version: v1.0.0-pre.2
The text was updated successfully, but these errors were encountered: