glimmerjs / glimmer-vm

MIT License
1.13k stars 188 forks source link

Strict mode: helpers inside attribute concats are not auto-invoked #1572

Open chancancode opened 3 months ago

chancancode commented 3 months ago
{{!-- works in standalone hbs --}}
<div class="it {{works}}" />
{{!-- does not work in gjs, calls Function.prototype.toString instead --}}
function works() {
  return "works";
}

<template>
  <div class="it {{works}}" />
</template>

Strict mode RFC only intended the change for arguments, not attributes: https://github.com/emberjs/rfcs/blob/508ac9b95bf2a4b397bf72b8e51d981c14c42535/text/0496-handlebars-strict-mode.md#3-no-implicit-invocation-of-argument-less-helpers

patricklx commented 3 months ago

mmm, and what about {{(works)}}?

chancancode commented 3 months ago

Yep it does, but it is a bug that it is necessary; also makes codemods (or just manual migration) etc harder when there are inconsistencies like these