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

attrchange

v1.0.1

Published

attrchange is a simple jQuery crossbrowser plugin to bind a listener function to any HTML element on attribute change.

Downloads

72

Readme

###attrchange

attrchange is a simple jQuery plugin to bind a listener function on attribute change of an element. The handler function is triggered when an attribute is added, removed or modified to the element.

This core attrchange plugin uses one of the following compatible methods based on the browser to detect an attribute change,

  1. Mutation Observer
  2. DOMAttrModified
  3. onpropertychange
Latest Updates:

The plugin code is majorly refactored to support extensions. Extensions are simple independent addons to the core plugin to performs a specific function.

In the last release, The plugin code is refactored to move the extensions code to a new file [attrchange_ext.js] (https://raw.githubusercontent.com/meetselva/attrchange/6e2cd8df1c5e365b6fd0400ae270a1a6955f4785/attrchange.js). The core plugin attrchange.js should still work independently.

Following are some of the useful addon added to the extensions,

  1. Polling: Added Polling to detect attrchange by polling
    • This technique is extensive but useful at times based on the requirement
    • Added 2 modes, 1. Simple polling 2. Computed polling
    • Simple Polling is the basic polling where the callback is triggered when an attribute is modified programmatically
    • Computed Polling is extensive but useful to detect any style property changes
  2. Disconnect: Allows to stop listenting when an attribute is modified
    • 2 modes of disconnect 1. Physical 2. Logical
    • Logical disconnect is a temporary disconnect. We can re-connect to the handler anytime using the reconnect function
    • Physical disconnect is permanent and cannot be reconnected, however you can establish a new connection anytime
  3. Re-connect: Allows to re-connect a connection that was logically disconnected
  4. Remove: is same as Physical disconnect that removes the listener function
  5. Get Properties: Returns an object with information about the connection
    • method Returns a String information about the method that is used to detect an attribute change. It should be one of the values in ['propertychange', 'DOMAttrModified', 'Mutation Observer', 'polling']
    • isPolling Returns a Boolean. True if the selected method is polling, else returns false
    • pollingInterval Returns an integer value of the polling interval.
    • status Returns a String information about the current connection status. It should be one of the values in ['connected', 'disconnected', 'removed']

Important Note: The below documentation link is for the core plugin and the information about extension are not available yet. I am working on a new website for documenation :wink:, until then please refer to the samples under examples folder to know about extensions.

Feel free to drop a comment or feedback at http://meetselva.github.io/#disqus or report an issue at https://github.com/meetselva/attrchange/issues

Full Documentation:

http://meetselva.github.com/attrchange/

References

  • http://stackoverflow.com/questions/1397251/event-detect-when-css-property-changed-using-jquery
  • http://stackoverflow.com/questions/20487472/jquery-when-element-becomes-visible