mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-16 22:30:36 +08:00
perf(jqLite): improve createEventHandler method by switching from forEach to for loop
This commit is contained in:
@@ -740,9 +740,9 @@ function createEventHandler(element, events) {
|
||||
// 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);
|
||||
});
|
||||
for (var i = 0, ii = eventHandlersCopy.length; i < ii; i++) {
|
||||
eventHandlersCopy[i].call(element, event);
|
||||
}
|
||||
|
||||
// Remove monkey-patched methods (IE),
|
||||
// as they would cause memory leaks in IE8.
|
||||
|
||||
Reference in New Issue
Block a user