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

This commit is contained in:
John Resig 2006-03-27 07:09:28 +00:00
parent b9e0b6ff37
commit 11e82e95b6

7
jquery/jquery.js vendored
View file

@ -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) {