if (!element.events) element.events = {}; if (!element.events[type]) element.events[type] = []; element.events[type].push(handler);