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

Aliases should be reachable within the event handlers which are fired by a component #3215

Open
ceremcem opened this issue Mar 18, 2018 · 1 comment

Comments

@ceremcem
Copy link

Description:

If an alias is created {{#with reference as alias}}, it should be reachable within an event handler that is fired not only by a standart HTML elements, but also by a component: Playground

If we change

			alert('filename is: ' + ctx.get('filename'))

to

			alert('filename is: ' + ctx.get('@key'))

it starts working but this introduces extra complexity because

  • this filename alias would have to be calculated twice
  • filename alias might be a very long expression which would cause opening the door of bugs when exact same calculation is maintained in two different locations (one in the template, other in the js file)

Versions affected:

0.9.13

@evs-chris
Copy link
Contributor

I think that the latter behavior is arguably the bug. If you want access to data, in this case @key, which only exists in the template outside of the component, you would need to disable isolation. That would be much more consistent with what isolation is about - not letting stuff from outside of the component leak in.

Perhaps a solution to this could be to add different levels of isolation e.g. data, plugin, context, etc? true and false could remain the switch for wholesale enabling and disabling all of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants