how to access jquery internal data?

Posted by Unknown on Stack Overflow See other posts from Stack Overflow or by Unknown
Published on 2012-04-02T11:26:23Z Indexed on 2012/04/02 11:29 UTC
Read the original article Hit count: 191

Filed under:

As you may or may not be aware as of jQuery 1.7 the whole event system was rewritten from the ground up. The codebase is much faster and with the new .on() method there is a lot of uniformity to wiring up event handlers.

One used to be able to access the internal events data and investiate what events are registered on any given element, but recently this internal information has been hidden based on the following scenario...

It seems that the "private" data is ALWAYS stored on the .data(jQuery.expando) - For "objects" where the deletion of the object should also delete its caches this makes some sense.

In the realm of nodes however, I think we should store these "private" members in a separate (private) cache so that they don't pollute the object returned by $.fn.data()"

Although I agree with the above change to hide the internal data, I have found having access to this information can be helpful for debugging and unit testing.

What was the new way of getting the internal jquery event object in jQuery 1.7?

© Stack Overflow or respective owner

Related posts about jQuery