event-synthetic-min.js revision 7f83404c6ad2c3e1f2b57720d25998da265f4d1e
YUI.add("event-synthetic",function(E){var A=E.Env.evt.dom_map,C=E.Array,D=function(){};function B(){this._init.apply(this,arguments);}B.prototype={constructor:B,_init:function(){if(!this.publishConfig){this.publishConfig={};}if(!("emitFacade" in this.publishConfig)){this.publishConfig.emitFacade=true;}},processArgs:D,init:D,on:D,detach:D,destroy:D,initDelegate:D,onDelegate:D,detachDelegate:D,destroyDelegate:D,_getEvent:function(H){var I=H.getEvent(this.type),G,F;if(!I){G=E.stamp(H._node);F="event:"+G+this.type;I=H.publish(this.type,this.publishConfig);I.el=H._node;I.key=F;I.domkey=G;I.fn=D;I.capture=false;I.monitor("detach",this._unsubscribe,this);(A[G]||(A[G]={}))[F]=I;}return I;},_on:function(F){var H=[],J=(typeof F[2]==="string")?F[2]:null,G=(J)?E.Selector.query(J):C(F[2]),I;if(!G.length&&J){I=E.on("available",function(){E.mix(I,E.on.apply(E,F),true);},J);return I;}E.each(G,function(K){var L=E.one(K),M=this._getEvent(L);I=this._subscribe(M,F.slice(),L);if(I){H.push(I);}},this);return(H.length===1)?H[0]:new E.EventHandle(H);},_subscribe:function(K,G,I){var F=this.processArgs(G),L,J,H;G[2]=I;G.shift();if(!this.allowDups){L=this.findDup.apply(this,[K.subscribers].concat(G));}if(!L){J=K.on.apply(K,G);H=J.sub;H._extra=F;if(this.fireFilter){E.Do.before(this._fireFilter,H,"_notify",this,H);}if(!K.initialized){this.init(I,J.sub,K);K.initialized=true;}this.on(I,J.sub,K);}return J;},findDup:function(G,I,F){var J,H;for(J in G){if(G.hasOwnProperty(J)){H=G[J];if((!I||H.fn===I)&&(!F||H.context===F)){return true;}}}return false;},_fireFilter:function(I,F,H,G){if(!this.fireFilter(G,F,I,H)){return new E.Do.Prevent();}},_detach:function(F){var H=F[1],G=(typeof F[2]==="string")?E.Selector.query(F[2]):C(F[2]);if(G.length){E.each(G,function(I){var J=E.one(I),K=J.getEvent(this.type);if(K){K.detach(H,J);}},this);}},_unsubscribe:function(H){var G=H.ce,F=H.sub.context;this.detach(F,H.sub,G);if(!G.hasSubs()){this.destroy(F,H.sub,G);G.initialized=false;G.detach(this._unsubscribe,this);}},_delegate:function(F){}};E.Node.publish=E.Event.define=function(H,G){if(!G){G={};}var I=(E.Lang.isObject(H))?H:E.merge({type:H},G),J,F;if(!E.Node.DOM_EVENTS[I.type]){J=function(){B.apply(this,arguments);};E.extend(J,B,I);F=new J();H=F.type;E.Node.DOM_EVENTS[H]=E.Env.evt.plugins[H]={on:function(){return F._on(C(arguments));},detach:function(){return F._detach(C(arguments));},delegate:function(){return F._delegate(C(arguments));}};}};},"@VERSION@",{requires:["node-base","event-custom"]});