fix events not overwriting target/type

This commit is contained in:
Vladimir Agafonkin 2013-02-27 16:34:40 +02:00
parent 6fff98435c
commit 1d4e91f9fa

View File

@ -9,7 +9,7 @@ L.Mixin = {};
L.Mixin.Events = { L.Mixin.Events = {
addEventListener: function (types, fn, context) { // (String, Function[, Object]) or (Object[, Object]) addEventListener: function (types, fn, context) { // (String, Function[, Object]) or (Object[, Object])
var events = this[key] = this[key] || {}, var events = this[key] = this[key] || {},
type, i, len, evt, type, i, len, evt,
contextId, objKey, objLenKey, eventsObj; contextId, objKey, objLenKey, eventsObj;
@ -116,10 +116,10 @@ L.Mixin.Events = {
return this; return this;
} }
var event = L.Util.extend({ var event = L.Util.extend({}, data, {
type: type, type: type,
target: this target: this
}, data); });
var listeners, i, len, eventsObj, contextId; var listeners, i, len, eventsObj, contextId;
@ -132,7 +132,7 @@ L.Mixin.Events = {
} }
// fire event for the context-indexed listeners as well // fire event for the context-indexed listeners as well
eventsObj = this[key][type + '_idx']; eventsObj = this[key][type + '_idx'];
if (eventsObj) { if (eventsObj) {