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) { ...@@ -697,9 +697,10 @@ function removeEvent(element, type, handler) {
} }
}; };
function triggerEvent(element,type) { function triggerEvent(element,type,data) {
if ( element["on" + type] ) data = data || [{ type: type }];
element["on" + type]({ type: type }); if ( element && element["on" + type] )
$.apply( element, element["on" + type], data );
} }
function handleEvent(event) { 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