JSPM

copy-event-attributes

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q19160F
  • License MIT

Copies event attributes from one DOM node to another

Package Exports

  • copy-event-attributes

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (copy-event-attributes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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