Understanding Dean Edwards' addevent JavaScript
问题 I need help understanding this piece of code. What is the point of handler.guid ? Why is there a need for a hash table? What is the point of: if ( element["on" + type]) { handlers[0] = element["on" + type]; } What does the "this" refer to in handleEvent , the element or the the addEvent function? function addEvent(element, type, handler) { // assign each event handler a unique ID if (!handler.$$guid) handler.$$guid = addEvent.guid++; // create a hash table of event types for the element if (