npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

conglomerate-dom-event

v2.2.3

Published

Create and manage a DOM event delegator.

Downloads

7

Readme

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.