define(["jquery"],function(d){var f=d.event.trigger;var e=Element.fire;var a=function(g){return g&&g.substr(0,6)==="xwiki:"};var b=function(g,i,j,p){var r=f(g,i,j,p);var q,k;if(g&&typeof(g)==="object"&&g.type){q=g;k=g.type}else{if(typeof(g)==="string"){k=g}}var o=q&&typeof(q.isImmediatePropagationStopped)==="function"&&q.isImmediatePropagationStopped();if(!o&&j&&a(k)){var n=d.isArray(i)?i[0]:i;var h=q&&typeof(q.isPropagationStopped)==="function"&&q.isPropagationStopped();var l=!h&&!p;var m=e(j,k,n,l);if(m.stopped&&q&&typeof(q.preventDefault)==="function"){q.preventDefault()}}return r};var c=function(l,j,i,h){var k=e(l,j,i,h);if(a(j)){var g=d.Event(j);var n=i?[i]:null;var m=k.stopped||h===false;f(g,n,l,m);if(g.isDefaultPrevented()||g.isPropagationStopped()){k.stop()}}return k};d.event.trigger=b;Element.addMethods({fire:c});Object.extend(Event,{fire:c});Object.extend(document,{fire:c.methodize()})});