-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Ember 2.12 action handlers can fire twice for IE and Edge #15076
Comments
So I bisected this and it turns out to that it was caused by this commit: ce35e6c . Reading my original description and looking at the commit, it's obvious why it broke. But it was also a little bit of a coincidence that it just worked before. Honestly, I'm not sure why the loop over the element attributes continues after it finds a handler? I guess it's because you could have multiple CC: @GavinJoyce |
I think the simplest fix would be to track the actions that have already been called during the single loop and if a given action were already ran, noop it. |
@rwjblue I'm 👍 on that. Shall I open a PR? |
Yep, if you don't mind. Will need a test to help ensure we don't regress again in the future. I believe it should at least be |
@rwjblue Roger that! I'm on it, you'll have a PR tonight because it's an upgrade blocker for us. Side note, a test would be very easy to write, but does ember.js CI process test IE / Edge? Either way I'll test it, just curious. |
Yes, we test in IE9, IE10, IE11, and Edge (as well as Chrome, Firefox, Safari, and phantom) in CI. |
…d action handlers to be fired twice.
…d action handlers to be fired twice.
…d action handlers to be fired twice.
…d action handlers to be fired twice.
…d action handlers to be fired twice.
…d action handlers to be fired twice.
…d action handlers to be fired twice.
@workmanw your PR has been merged. Can this be closed or is there anything left to do? Thank you! |
@Serabe Ooops, I thought it was auto closed with the merge. Sorry about that. |
…n handlers to be fired twice. (cherry picked from commit 00e95be)
…n handlers to be fired twice. (cherry picked from commit 00e95be)
Here is a JSBin: http://jsbin.com/cufupaw/edit?html,js,console,output
(JSBin instead of ember-twiddle because of IE)
If you click 'red', 'yellow' or 'blue' in chrome you'll notice the color of the text changes to green to reflect the "selected state", if you try this fiddle in IE it will not change. If you look at the JSBin console pane you'll see that the event handle logged that it was invoked twice. The first time toggled
selected: true
, the second back to false.So why did this happen? The reason it happens is because the element with the action handler, also has a
class="{{if item.selected 'selected'}}"
. To understand what's happening you'll need to first look at: event_dispatcher.js. Notice how it's looping over the element's attributes looking for an action handler. So here is the exact order of what happens:attributes.item(2)
attributes.item(2)
toattributes.item(3)
.attributes.item(3)
finding the exact same handler, and recalls it.Here is screenshot of the first invocation of the action handler:
Here is a screenshot of the second invocation of the action handler:
This works with Ember 2.11. So somewhere along the way something changed.
The text was updated successfully, but these errors were encountered: