New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dom-delegation-stream

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-delegation-stream

streaming DOM event delegation

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

dom-delegation-stream

Build Status npm install npm version License

simple streaming DOM event delegation

example

var events = require('dom-delegation-stream')
var values = require('dom-value-stream')

events(document.body, 'input', 'input[type=text]')
  .pipe(values())
  .pipe(wherever())

API

events(element, eventName[, selector, options]) -> ReadableStream
  • if selector is provided, delegation will be used, otherwise it will not.
  • valid options are:
    • preventDefault <boolean>: will call preventDefault() on all matched events. Defaults to false.
    • stopPropagation <boolean>: will call stopPropagation() on all matched events. Defaults to false.
    • useCapture <boolean>: will initiate capture for matched events. Defaults to false.

notes

  • when using delegation, the element that matches your selector will be available as event.delegationTarget.
  • calling .end() or otherwise ending the stream returned by dom-delegation-stream will remove the listeners added for event handling.
  • there are some alternative options for event handling on npm, a couple that even support delegation, and even some that are streaming. this module was created as an effort to provide a better balance of simplicity and flexibility.

license

MIT

Keywords

FAQs

Package last updated on 29 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc