aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jqLite.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/jqLite.js b/src/jqLite.js
index 8a45f966..c1b5b36e 100644
--- a/src/jqLite.js
+++ b/src/jqLite.js
@@ -645,7 +645,10 @@ function createEventHandler(element, events) {
return event.defaultPrevented || event.returnValue === false;
};
- forEach(events[type || event.type], function(fn) {
+ // 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);
});