Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

conglomerate-dom-event

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

conglomerate-dom-event

Create and manage a DOM event delegator.

  • 2.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

NPM version Build Status

conglomerate-dom-event

Adaptation of DOM Delegate, developed by FT Labs, part of the Financial Times.

Simple, easy-to-use component for binding to events on all target elements matching the given selector, irrespective of whether anything exists in the DOM at registration time or not. This allows developers to implement the event delegation pattern.

Thanks

The developers of ftdomdelegate are Matthew Andrews and Matthew Caruana Galizia. Test engineering by Sam Giles. The API is influenced by jQuery Live. All open source code released by FT Labs is licenced under the MIT licence. We welcome comments, feedback and suggestions. Please feel free to raise an issue or pull request.

Thanks to Sauce Labs for providing the infrastructure that allows us to run our build in real browsers.

Documentation

Delegate

src/index.js:13-28

DOM event delegator

The delegator will listen for events that bubble up to the root node.

Parameters

  • root (Node|string)= The root node or a selector string matching the root node

captureForType

src/index.js:92-94

Parameters

Returns **** boolean

destroy

src/index.js:432-435

Short hand for off() and root(), ie both with no parameters

Returns **** void

fire

src/index.js:267-270

Fire a listener on a target.

Parameters

Returns boolean

handle

src/index.js:170-257

Handle an arbitrary event.

Parameters

off

src/index.js:106-162

Remove an event handler for elements that match the selector, forever

Parameters

  • eventType string= Remove handlers for events matching this type, considering the other parameters
  • selector string= If this parameter is omitted, only handlers which match the other two will be removed
  • handler function ()= If this parameter is omitted, only handlers which match the previous two will be removed
  • useCapture

Returns Delegate This method is chainable

on

src/index.js:356-423

Attach a handler to one event for all elements that match the selector, now or in the future

The handler function receives three arguments: the DOM event object, the node that matched the selector while the event was bubbling and a reference to itself. Within the handler, 'this' is equal to the second argument.

The node that actually received the event can be accessed via 'event.target'.

Parameters

  • eventType string Listen for these events
  • selector (string|undefined) Only handle events on elements matching this selector, if undefined match root element
  • handler function () Handler function - event data passed here will be in event.data
  • eventData Object= Data to pass in event.data
  • useCapture

Returns Delegate This method is chainable

root

src/index.js:37-86

Start listening for events on the provided DOM element

Parameters

  • root (Node|string)= The root node or a selector string matching the root node

Returns Delegate This method is chainable

handle

src/index.js:27-27

listenerMap

src/index.js:21-21

Maintain a map of listener lists, keyed by event name.

matches

src/index.js:279-284

Check whether an element matches a generic selector.

Parameters

  • selector string A CSS selector

matchesId

src/index.js:327-329

Check whether the ID of the element in 'this' matches the given ID.

IDs are case-sensitive.

Parameters

  • id string The ID to test against
  • element Element The element to test with

Returns **** boolean

matchesRoot

src/index.js:311-314

Check whether an element matches the root.

Parameters

  • selector ?String In this case this is always passed through as null and not used
  • element Element The element to test with

Returns **** boolean

matchesTag

src/index.js:299-301

Check whether an element matches a tag selector.

Tags are NOT case-sensitive, except in XML (and XML-based languages such as XHTML).

Parameters

  • tagName string The tag name to test against
  • element Element The element to test with

Returns **** boolean

rootElement

src/index.js:71-71

The root node at which listeners are attached.

License

conglomerate-dom-event is released under the terms of the BSD-3-Clause license.

This software includes or is derivative of works distributed under the licenses listed below. Please refer to the specific files and/or packages for more detailed information about the authors, copyright notices, and licenses.

Keywords

FAQs

Package last updated on 30 Mar 2016

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