Native JS does not support anonymous uninstall events, jquery is useful for developers to support anonymous
Thoughts on anonymous Events
First she will determine whether the target is an element or an object, and if it is an element, mark the element with an identifier (expando) and then the value is a GUID generated and a cache is created under the cache object, such as:
$.cache={
' 2 ': {
data: {},
events: {},
handle:function () {}}
,
}
Then you will trigger the element event to take the identity of the elements to find in the cache, and there will be commissioned, selectors and other judgments, and then the final trigger, uninstall is actually taken in the cache handle uninstall, because it is a ...
If the target is not an element, such as a window, then she will add the logo directly to the target, for example: Window[$.expando]
Actually, the event has a very deep relationship with the cache.
Uninstall All Events
Empty identity
The identity here includes the elements and the objects on the
$ (' * '). Add (Window). each (function () {
try{
delete This[$.expando];
}catch (e) {}
});
PS: Because window is not an element, there are some events, such as scroll,resize, etc.
Delete Cache
The cache here includes the element's cache and the object cache
Window[$.expando] = {}
$.cache = {};
jquery Deletes an existing event instance