Commit 11e82e95 authored by John Resig's avatar John Resig

Added checks to triggerEvent for optional data and element verification. Uses $.apply() now, too.

parent b9e0b6ff
......@@ -697,9 +697,10 @@ function removeEvent(element, type, handler) {
}
};
function triggerEvent(element,type) {
if ( element["on" + type] )
element["on" + type]({ type: type });
function triggerEvent(element,type,data) {
data = data || [{ type: type }];
if ( element && element["on" + type] )
$.apply( element, element["on" + type], data );
}
function handleEvent(event) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment