copy-event-attributes

1.0.1 • Public • Published

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

Package Sidebar

Install

npm i copy-event-attributes

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • allouis