Skip to content

Commit

Permalink
[BUGFIX beta] data-ember-action no longer has a value
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinJoyce committed Jan 24, 2017
1 parent e0ce3f7 commit 7e177ec
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions packages/ember-views/lib/system/event_dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,33 +218,23 @@ export default EmberObject.extend({
});

rootElement.on(`${event}.ember`, '[data-ember-action]', evt => {
let actionId = jQuery(evt.currentTarget).attr('data-ember-action');
let actions = ActionManager.registeredActions[actionId];

// In Glimmer2 this attribute is set to an empty string and an additional
// attribute it set for each action on a given element. In this case, the
// attributes need to be read so that a proper set of action handlers can
// be coalesced.
if (actionId === '') {
let attributes = evt.currentTarget.attributes;
let attributeCount = attributes.length;

actions = [];

for (let i = 0; i < attributeCount; i++) {
let attr = attributes.item(i);
let attrName = attr.name;

if (attrName.indexOf('data-ember-action-') === 0) {
actions = actions.concat(ActionManager.registeredActions[attr.value]);
}
let attributes = evt.currentTarget.attributes;
let attributeCount = attributes.length;
let actions = [];

for (let i = 0; i < attributeCount; i++) {
let attr = attributes.item(i);
let attrName = attr.name;

if (attrName.indexOf('data-ember-action-') === 0) {
actions = actions.concat(ActionManager.registeredActions[attr.value]);
}
}

// We have to check for actions here since in some cases, jQuery will trigger
// an event on `removeChild` (i.e. focusout) after we've already torn down the
// action handlers for the view.
if (!actions) {
if (actions.length === 0) {
return;
}

Expand Down

0 comments on commit 7e177ec

Please sign in to comment.