dom-event-listener
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -5,3 +5,3 @@ 'use strict'; | ||
forEach = require('lodash/forEach'), | ||
clone = require('lodash/clone'), | ||
clone = require('lodash/cloneDeep'), | ||
merge = require('lodash/merge'), | ||
@@ -71,8 +71,22 @@ | ||
function onEvent(event) { | ||
var newEvent = merge({}, event); | ||
var newEvent = {}; | ||
newEvent.currentTarget = element; | ||
newEvent.target = newEvent.target || newEvent.srcElement; | ||
newEvent.preventDefault = newEvent.preventDefault || preventDefault; | ||
for (var property in event) { | ||
newEvent[property] = event[property]; | ||
} | ||
if (event.preventDefault) { | ||
newEvent.preventDefault = event.preventDefault.bind(event); | ||
} else { | ||
newEvent.preventDefault = preventDefault; | ||
} | ||
if (!newEvent.target) { | ||
newEvent.target = newEvent.srcElement; | ||
} | ||
if (!newEvent.currentTarget) { | ||
newEvent.currentTarget = element; | ||
} | ||
handleEvent(newEvent, bubbling); | ||
@@ -79,0 +93,0 @@ } |
{ | ||
"name": "dom-event-listener", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Cross browser event listeners", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
13530
244