Skip to content

Commit

Permalink
Try using the element's own addEventListener
Browse files Browse the repository at this point in the history
This tries defering to the element's own addEventListener.
  • Loading branch information
matthewp committed Feb 3, 2017
1 parent c93641f commit 4fbb7eb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions can-define.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ module.exports = define = ns.define = function(objPrototype, defines, baseDefine
return data;
});


// Add necessary event methods to this object.
for (var prop in eventsProto) {
Object.defineProperty(objPrototype, prop, {
Expand Down Expand Up @@ -177,7 +176,7 @@ define.property = function(objPrototype, prop, definition, dataInitializers, com
if ((definition.value !== undefined || definition.Value !== undefined)) {
getInitialValue = make.get.defaultValue(prop, definition, typeConvert, eventsSetter);
}

// If property has a getter, create the compute that stores its data.
if (definition.get) {
computedInitializers[prop] = make.compute(prop, definition.get, getInitialValue);
Expand Down Expand Up @@ -657,7 +656,10 @@ assign(eventsProto, {

}

return eventLifecycle.addAndSetup.apply(this, arguments);
var baseAddEventListener = this.__proto__.addEventListener ||
eventLifecycle.addAndSetup;

return baseAddEventListener.apply(this, arguments);
},

// ### unbind
Expand Down

0 comments on commit 4fbb7eb

Please sign in to comment.