event-focus-min.js revision b517f2369a42f0d732929584a134778f1ee7d58e
YUI.add("event-focus",function(f){var d=f.Event,c=f.Lang,a=c.isString,e=f.Array.indexOf,b=c.isFunction(f.DOM.create('<p onbeforeactivate=";"/>').onbeforeactivate);function g(i,h,k){var j="_"+i+"Notifiers";f.Event.define(i,{_attach:function(m,n,l){if(f.DOM.isWindow(m)){return d._attach([i,function(o){n.fire(o);},m]);}else{return d._attach([h,this._proxy,m,this,n,l],{capture:true});}},_proxy:function(o,s,q){var p=o.target,m=o.currentTarget,r=p.getData(j),t=f.stamp(m._node),l=(b||p!==m),n;s.currentTarget=(q)?p:m;s.container=(q)?m:null;if(!r){r={};p.setData(j,r);if(l){n=d._attach([k,this._notify,p._node]).sub;n.once=true;}}if(!r[t]){r[t]=[];}r[t].push(s);if(!l){this._notify(o);}},_notify:function(w,m){var n=w.currentTarget,z=n.getData(j),s=n.ancestors(),y=n.get("ownerDocument"),q=[],u=z?f.Object.keys(z).length:0,v,x,B,A,r,p,o,t,l;n.clearData(j);s.push(n);if(y){s.unshift(y);}s._nodes.reverse();p=u;s.some(function(G){var F=f.stamp(G),D=z[F],E,C;if(D){u--;for(E=0,C=D.length;E<C;++E){if(D[E].handle.sub.filter){q.push(D[E]);}}}return !u;});u=p;while(u&&(v=s.shift())){A=f.stamp(v);x=z[A];if(x){for(o=0,t=x.length;o<t;++o){B=x[o];l=B.handle.sub;r=true;w.currentTarget=v;if(l.filter){r=l.filter.apply(v,[v,w].concat(l.args||[]));q.splice(e(q,B),1);}if(r){w.container=B.container;B.fire(w);}}delete x[A];u--;}for(o=0,t=q.length;o<t;++o){B=q[o];l=B.handle.sub;if(l.filter.apply(v,[v,w].concat(l.args||[]))){w.container=B.container;w.currentTarget=v;B.fire(w);}}}},on:function(n,l,m){l.onHandle=this._attach(n._node,m);},detach:function(m,l){l.onHandle.detach();},delegate:function(o,m,n,l){f.stamp(n);if(a(l)){m.filter=f.delegate.compileFilter(l);}m.delegateHandle=this._attach(o._node,n,true);},detachDelegate:function(m,l){l.delegateHandle.detach();}},true);}if(b){g("focus","beforeactivate","focusin");g("blur","beforedeactivate","focusout");}else{g("focus","focus","focus");g("blur","blur","blur");}},"@VERSION@",{requires:["event-synthetic"]});