event-custom-complex-min.js revision 9fda45dc4d91be4e7b639821b262ff74f2314294
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,queue:[]};M=A.Env._eventstack;}H=this.getSubs();this.stopped=0;this.prevented=0;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){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(O,M,K){var I=this._yuievt.targets,L=true,P,N,F,H,J,G;if(!O||((!O.stopped)&&I)){for(H in I){if(I.hasOwnProperty(H)){P=I[H];N=O&&O.type;F=P.getEvent(N,true);G=P.getSibling(N,F);if(G&&!F){F=P.publish(N);}if(!F){if(P._yuievt.hasTargets){P.bubble.apply(P,arguments);}}else{F.sibling=G;F.originalTarget=K||(O&&O.target)||this;F.currentTarget=P;J=F.broadcast;F.broadcast=false;L=L&&F.fire.apply(F,M||O.details||[]);F.broadcast=J;F.originalTarget=null;if(F.stopped){break;}}}}}return L;};C=new A.EventFacade();E=A.Object.keys(C);})();},"@VERSION@",{requires:["event-custom-base"]});