diff --git a/jquery.simulate.js b/jquery.simulate.js index 4ac556a..eeb5624 100644 --- a/jquery.simulate.js +++ b/jquery.simulate.js @@ -201,7 +201,9 @@ $.extend( $.simulate.prototype, { }, dispatchEvent: function( elem, type, event ) { - if ( elem.dispatchEvent ) { + if ( elem[ type ] ) { + elem[ type ](); + } else if ( elem.dispatchEvent ) { elem.dispatchEvent( event ); } else if ( elem.fireEvent ) { elem.fireEvent( "on" + type, event ); diff --git a/test/index.html b/test/index.html index 3e27a25..88ea915 100644 --- a/test/index.html +++ b/test/index.html @@ -19,5 +19,10 @@