event-custom-complex-min.js revision e63dfd3de2a2e8ced9df9776a0f607e2c54260c9
YUI.add("event-custom-complex",function(A){(function(){var C,E,B=A.CustomEvent.prototype,D=A.EventTarget.prototype;A.EventFacade=function(G,F){G=G||{};this.details=G.details;this.type=G.type;this._type=G.type;this.target=G.target;this.currentTarget=F;this.relatedTarget=G.relatedTarget;this.stopPropagation=function(){G.stopPropagation();};this.stopImmediatePropagation=function(){G.stopImmediatePropagation();};this.preventDefault=function(){G.preventDefault();};this.halt=function(H){G.halt(H);};};B.fireComplex=function(L){var M=A.Env._eventstack,I,F,J,G,K,N,H;if(M){if(this.queuable&&this.type!=M.next.type){this.log("queue "+this.type);M.queue.push([this,L]);return true;}}else{A.Env._eventstack={id:this.id,next:this,silent:this.silent,stopped:0,prevented:0,type:this.type,queue:[]};M=A.Env._eventstack;}H=this.getSubs();this.stopped=(this.type!==M.type)?0:M.stopped;this.prevented=(this.type!==M.type)?0:M.prevented;this.target=this.target||this.host;N=new A.EventTarget({fireOnce:true,context:this.host});this.events=N;if(this.preventedFn){N.on("prevented",this.preventedFn);}if(this.stoppedFn){N.on("stopped",this.stoppedFn);}this.currentTarget=this.host||this.currentTarget;this.details=L.slice();this.log("Firing "+this.type);this._facade=null;I=this._getFacade(L);if(A.Lang.isObject(L[0])){L[0]=I;}else{L.unshift(I);}if(H[0]){this._procSubs(H[0],L,I);}if(this.bubbles&&this.host&&this.host.bubble&&!this.stopped){if(M.type!=this.type){M.stopped=0;M.prevented=0;}K=this.host.bubble(this);this.stopped=Math.max(this.stopped,M.stopped);this.prevented=Math.max(this.prevented,M.prevented);}if(this.defaultFn&&!this.prevented){this.defaultFn.apply(this.host||this,L);}this._broadcast(L);if(H[1]&&!this.prevented&&this.stopped<2){this._procSubs(H[1],L,I);}if(M.id===this.id){J=M.queue;while(J.length){F=J.pop();G=F[0];M.stopped=0;M.prevented=0;M.next=G;G.fire.apply(G,F[1]);}A.Env._eventstack=null;}return this.stopped?false:true;};B._getFacade=function(){var F=this._facade,I,H,G=this.details;if(!F){F=new A.EventFacade(this,this.currentTarget);}I=G&&G[0];if(A.Lang.isObject(I,true)){H={};A.mix(H,F,true,E);A.mix(F,I,true);A.mix(F,H,true,E);F.type=I.type||F.type;}F.details=this.details;F.target=this.originalTarget||this.target;F.currentTarget=this.currentTarget;F.stopped=0;F.prevented=0;this._facade=F;return this._facade;};B.stopPropagation=function(){this.stopped=1;A.Env._eventstack.stopped=1;this.events.fire("stopped",this);};B.stopImmediatePropagation=function(){this.stopped=2;A.Env._eventstack.stopped=2;this.events.fire("stopped",this);};B.preventDefault=function(){if(this.preventable){this.prevented=1;A.Env._eventstack.prevented=1;this.events.fire("prevented",this);}};B.halt=function(F){if(F){this.stopImmediatePropagation();}else{this.stopPropagation();}this.preventDefault();};D.addTarget=function(F){this._yuievt.targets[A.stamp(F)]=F;this._yuievt.hasTargets=true;};D.removeTarget=function(F){delete this._yuievt.targets[A.stamp(F)];};D.bubble=function(P,N,L){var J=this._yuievt.targets,M=true,Q,O=P&&P.type,G,I,K,H,F=L||(P&&P.target)||this;if(!P||((!P.stopped)&&J)){for(I in J){if(J.hasOwnProperty(I)){Q=J[I];G=Q.getEvent(O,true);H=Q.getSibling(O,G);if(H&&!G){G=Q.publish(O);}if(!G){if(Q._yuievt.hasTargets){Q.bubble(P,N,F);}}else{G.sibling=H;G.originalTarget=F;G.currentTarget=Q;K=G.broadcast;G.broadcast=false;M=M&&G.fire.apply(G,N||P.details||[]);G.broadcast=K;G.originalTarget=null;if(G.stopped){break;}}}}}return M;};C=new A.EventFacade();E=A.Object.keys(C);})();},"@VERSION@",{requires:["event-custom-base"]});