Response title
This is preview!
This is a typical part of any event system: the ability to inspect what's been added
My tab example is a good illustration - if I can't ask what if any tab event has been attached, the whole thing can't work.Perhaps this is an indication that your design is flawed. Presumably, you're expecting someone else to trigger the tab event and the result of that changes based on some condition. Why not have a function that gets called instead? You can always change the behavior of the function based on conditions. Then the function does what it needs to and triggers an event. This is already how the DOM works. You never directly trigger an event. You call a method and that method triggers an event (or not).
I'm not proposing any change to the tab key in the jquery library - can we try to stay on topic?We are staying on topic. When you want a feature added, you must provide use cases. If the use cases presented are deemed invalid or bad, then the feature won't be implemented.
Sticking with the ability to list events, then by your same logic should jQuery .hide() and .show() go away, since someone could change the display CSS property in between/before usage of hide and show and disrupt its expectations? That this feature is bad design because "nobody else would ever want to do the same thing?"These aren't even close to the same thing. Can we try to stay on topic?
There are plenty more use cases around libraries playing nicely with each other. For example a jQuery plugin might have to destroy and recreate some DOM elements in order to respond to a request (as a simple example imagine a rotator plugin that lets you add a clickable area to it). It's useful to check on any events assigned to that DOM object you're going to have to destroy, set them aside, and reattach them once you've recreated things.This is another terrible thing. Don't destroy the DOM if you don't need to. I've never seen a rotator plugin that requires destroying the DOM instead of just decorating it.
Or simple read scenarios - you could gather usage data of your plugin for example and include a list of events people actually tied into.This can (and probably should) be accomplish by wrapping .on() to store which events are being used.
Dave, the only thing that makes it internal is that jQuery hasn't got an external .events() call - if it did, it wouldn't be internals.I'm not sure what you hope to accomplish by defining the words internal and external. It's actually much more than that. Making something publish isn't just a matter of exposing a method that returns a value. It requires documentation, tests, and never ending support. It's a guarantee that the data structure is permanent. It's a hindrance to potential performance improvements and architectural changes. It's a statement that we think it's a good idea to query, inspect, and modify the data. This isn't just some random thing that we overlooked. It's a conscious decision that was made a long time ago and has been repeatedly explained.
In addition, if I set 5 events on something and want to ask "Did you get those?" I should be able to see the external stuff I passed into it.Why? The answer to "Did you get those?" is "Yes; I did not throw an error, assume everything is fine." You don't need to ask if your handlers were applied. If you need to track your own handlers for whatever reason, you can do that in your code.
Thanks for dismissing your users.If three days of constant responses is dismissive, then I'll just stop now.
© 2013 jQuery Foundation
Sponsored by and others.