1,bind method, the last parameter FN is redundant
Copy Code code as follows:
Handle Object Literals
if (typeof type = = = "Object") {
for (var key in type) {
this[name] (key, data, Type[key], FN);
}
return this;
}
2, note
Copy Code code as follows:
Add which for click:1 = = left; 2 = = middle; 3 = = Right
should be amended to read
Copy Code code as follows:
Add which for mousedown/mouseup:1 = = left; 2 = = middle; 3 = = Right
3,data method, the local variable internalkey is defined, but the following code still follows Jquery.expando.
Copy Code code as follows:
var internalkey = Jquery.expando, getbyname = typeof name = = = "String", Thiscache,
4,jquery.event.add method, arguments changed to e,apply instead of call better. Because only one argument is passed: the event object.
Copy Code code as follows:
Elemdata.handle = Eventhandle = function (e) {
Discard the second event of a JQuery.event.trigger () and
When the event is called after a page has unloaded
Return typeof jQuery!== "undefined" && (!e | | jQuery.event.triggered!==)?
JQuery.event.handle.apply (Eventhandle.elem, arguments):
Undefined
};
5, based on the "Do not repeat detection browser" principle, jQuery.event.add the following code
Copy Code code as follows:
if (Elem.addeventlistener) {
Elem.addeventlistener (Type, eventhandle, false);
else if (elem.attachevent) {
Elem.attachevent ("On" + Type, eventhandle);
}
You should use the following to replace
Copy Code code as follows:
Jquery.addevent = Document.addeventlistener?
function (elem, type, handle) {
if (Elem.addeventlistener) {
Elem.addeventlistener (type, handle, false);
}
} :
function (elem, type, handle) {
if (elem.attactevent) {
Elem.attactevent ("On" + type, handle);
}
};
In fact, jquery has a jquery.removeevent, but somehow there is no jquery.addevent.