question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ember 2.12 action handlers can fire twice for IE and Edge

See original GitHub issue

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:

  1. Click
  2. event_dispatcher finds the element and the action handler at attributes.item(2)
  3. action handler is invoked and toggles state, which then changes the DOM by adding a class.
  4. That DOM change shifts the action handlers position from attributes.item(2) to attributes.item(3).
  5. The action handler returns, the next loop moves to attributes.item(3) finding the exact same handler, and recalls it.

Here is screenshot of the first invocation of the action handler: image

Here is a screenshot of the second invocation of the action handler: image

This works with Ember 2.11. So somewhere along the way something changed.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
rwjbluecommented, Mar 27, 2017

Yes, we test in IE9, IE10, IE11, and Edge (as well as Chrome, Firefox, Safari, and phantom) in CI.

0reactions
workmanwcommented, Apr 7, 2017

@Serabe Ooops, I thought it was auto closed with the merge. Sorry about that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling Events - Components - Ember Guides
You can respond to user events on your component like double-clicking, hovering, and key presses through event handlers. Simply implement the name of...
Read more >
@ember/test-helpers | Yarn - Package Manager
A test-framework-agnostic set of helpers for testing Ember.js applications. Compatibility. Ember 3.8 or above; Ember CLI 3.8 or above; Node.js 10 or above ......
Read more >
Granicus - Bend Fire & EMS, OR One (1) Velocity Pumper NH791 ...
Acceptance of Proposal: If the customer wishes to purchase the proposed apparatus Hughes Fire Equipment will provide the Customer its.
Read more >
DANGER DANGER
FIRE OR EXPLOSION HAZARD. Failure to follow safety warnings exactly could result in serious injury, death or property damage. • Do not store...
Read more >
sec_E_SB_ELA_G7.pdf - TN.gov
SpringBoard will support your learning. Instructional Materials. SpringBoard English Language Arts supplies a Student Edition and Teacher Edition, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found