1.0.1 • Published 8 years ago

copy-event-attributes v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

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
})