jQuery custom events on non-DOM objects
问题 I read some code recently that does something like this: bob = {'name': 'Bob Smith', 'rank': 7}; $(bob).bind("nameChanged", function () { /* ... */}); // ... $(bob).trigger("nameChanged"); This appears to work. But I can't find anything in the jQuery documentation or source about calling the jQuery constructor with an object that is neither a selector nor a DOM node. So my question is, is this a supported use, or is it essentially working by accident? If you wanted to use an event-driven