copy-event-attributes
v1.0.1
Published
Copies event attributes from one DOM node to another
Downloads
4
Readme
copy-event-attributes
This was pulled out of yo-yo because I wanted the nicer morphdom it provides, but without the dependency on bel
usage
var copyEvents = require('copy-event-attributes')
copyEvents(fromEl, toEl)usage with morphdom
var copyEvents = require('copy-event-attributes')
var morphdom = require('morphdom')
morphdom(fromEl, toEl, {
onBeforeMorphEl: copyEvents
})usage with custom events
var copyEvents = require('copy-event-attributes')
var morphdom = require('morphdom')
function copyCustomEvents (fromEl, toEl) {
return copyEvents(fromEl, toEl, ['onmyevent'])
}
morphdom(fromEl, toEl, {
onBeforeMorphEl: copyCustomEvents
})