Skip to content
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

Avoiding collisions between Handlebars helper names and variable names #756

Closed
alexweissman opened this issue Jul 3, 2017 · 5 comments
Closed
Labels
compatibility Compatibility issue with other framework, features frontend The frontend interface
Milestone

Comments

@alexweissman
Copy link
Member

As #748 demonstrated, Handlebars doesn't distinguish between invoking a helper, versus referencing a variable parameter, in its syntax:

// Reference a helper called 'slug'
<code>{{slug}}</code>

// Reference a parameter called 'slug'
<code>{{slug}}</code>

There are basically two ways that we can avoid this issue:

  1. Use {{this.slug}} to explicitly reference the variable, not the helper;
  2. Come up with a special naming convention for our custom helpers.

I think (1) would be a better choice in terms of compatibility, not only with our current helpers but with other helper libraries that people might choose to load. I'm not sure if there any drawbacks, other than having to make a lot of changes in the existing templates. Thoughts?

@alexweissman alexweissman added compatibility Compatibility issue with other framework, features frontend The frontend interface labels Jul 3, 2017
@lcharette
Copy link
Member

1 is probably a nasty BC, but looks like a better option.

@alexweissman
Copy link
Member Author

Eh, most people won't experience collisions even if they don't update their templates to use this..

@lcharette
Copy link
Member

Oh. so it's not something that requires changes in the controllers?

@alexweissman
Copy link
Member Author

Nope, these are just changes to the client-side templates.

@alexweissman alexweissman added this to the 4.2.0 milestone Dec 20, 2017
@lcharette lcharette modified the milestones: 4.2.0, 4.3.0 Oct 13, 2018
@lcharette lcharette modified the milestones: 4.3.0, 4.4.0 Oct 20, 2018
@lcharette lcharette modified the milestones: 4.4.0, 4.5.0 Nov 23, 2019
@lcharette
Copy link
Member

Closing, as plan is to get rid of Handlebar ASAP

@lcharette lcharette closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Compatibility issue with other framework, features frontend The frontend interface
Projects
None yet
Development

No branches or pull requests

2 participants