Skip to content

Commit

Permalink
WIP: squash; change implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtajina committed Dec 17, 2013
1 parent f6ae0db commit b51049f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/jqLite.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ function jqLiteOff(element, type, fn, unsupported) {
if (isUndefined(fn)) {
removeEventListenerFn(element, type, events[type]);
delete events[type];
} else {
arrayRemove(events[type] || [], fn);
} else if (events[type]) {
events[type][indexOf(events[type], fn)] = null;
}
});
}
Expand Down Expand Up @@ -645,11 +645,8 @@ function createEventHandler(element, events) {
return event.defaultPrevented || event.returnValue === false;
};

// Copy event handlers in case event handlers array is modified during execution.
var eventHandlersCopy = shallowCopy(events[type || event.type] || []);

forEach(eventHandlersCopy, function(fn) {
fn.call(element, event);
forEach(events[type || event.type], function(fn) {
fn && fn.call(element, event);
});

// Remove monkey-patched methods (IE),
Expand Down

0 comments on commit b51049f

Please sign in to comment.