htmlbars icon indicating copy to clipboard operation
htmlbars copied to clipboard

fixes emberjs/ember.js#12506

Open Saranya-Raaj opened this issue 9 years ago • 4 comments

fixes emberjs/ember.js#12506

Saranya-Raaj avatar Feb 03 '16 05:02 Saranya-Raaj

This seems correct to me.

@mixonic / @mmun - Any objections?

rwjblue avatar Feb 03 '16 05:02 rwjblue

we should be careful about perf

stefanpenner avatar Feb 03 '16 05:02 stefanpenner

I second Stef's concern, get can be called a pretty significant amount of times. screen shot 2016-02-02 at 11 45 29 pm

chadhietala avatar Feb 03 '16 07:02 chadhietala

We already lookup helpers for curlies that appear outside of attributes: https://github.com/tildeio/htmlbars/blob/master/packages/htmlbars-runtime/lib/hooks.js#L698. Doing it for attributes as well is the correct thing to do.

That said, I don't like this particular implementation. get should not be looking up helpers. In {{foo bar}}, bar is never a helper, but with this implementation we would be checking if it was. Instead, we should add an ambiguous hook that delegates get or subexpr depending on whether the path resolves to a helper or not. The ambiguous hook would be called whenever there was a {{foo}} in the template (whether in content or in an attribute). {{foo.bar}} should not trigger the ambiguous hook however.

mmun avatar Feb 21 '16 08:02 mmun