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

Action helper fires action when action is called "on" in 0.9.6 #671

Closed
MrHus opened this issue Apr 11, 2012 · 4 comments
Closed

Action helper fires action when action is called "on" in 0.9.6 #671

MrHus opened this issue Apr 11, 2012 · 4 comments

Comments

@MrHus
Copy link

MrHus commented Apr 11, 2012

When adding an action named "on" it fires when the page is loaded:

http://jsfiddle.net/UgQvF/

This behavior was not present in ember 0.9.5:

http://jsfiddle.net/G7gUR/1/

@pangratz
Copy link
Member

That's because Ember.View has the Ember.Evented mixin applied since 0.9.6. And by naming your events on and off you are overriding the methods of the mixin. The first two "on" events which are fired in your example are willRender events.

So you have chosen the only 2 names for actions which cause problems. If you rename them to _on or _off it works as expected.

@pangratz
Copy link
Member

Another solution would be to override the on and off methods and adding a call to this._super if it's not an event from an action helper, see http://jsfiddle.net/pangratz666/tTaNF/

@MrHus
Copy link
Author

MrHus commented Apr 11, 2012

The workaround is to simply rename the on and off functions. I do not consider this behavior a bug now that I'm informed.
However a footnote in the documentation about this behavior would certainly be an improvement.

Thanks @pangratz for your help.

@MrHus MrHus closed this as completed Apr 11, 2012
@pangratz
Copy link
Member

@MrHus Glad I could help.

chancancode added a commit that referenced this issue Oct 5, 2020
This implements some of the deprecations proposed in [RFC #671][1].
The deprecations are gated behind the feature flag so they won't be
visible until the RFC is merged and the feature is enabled.

[1]: emberjs/rfcs#671
chancancode added a commit that referenced this issue Oct 5, 2020
This implements some of the deprecations proposed in [RFC #671][1].
The deprecations are gated behind the feature flag so they won't be
visible until the RFC is merged and the feature is enabled.

[1]: emberjs/rfcs#671
sandstrom pushed a commit to sandstrom/ember.js that referenced this issue Jun 17, 2021
…rn/percy/ember-2.1.4

Bump @percy/ember from 2.1.3 to 2.1.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants