node-min.js revision f77815d81ad76d60a1f1b834efbc7ed954437e6d
YUI.add("node-base",function(C){var G=".",E="nodeName",I="nodeType",B="ownerDocument",H="tagName",D="_yuid",F=function(L){var K=L[D];if(K&&F._instances[K]&&F._instances[K]._node!==L){L[D]=null;}K=C.stamp(L);if(!K){K=C.guid();}this[D]=K;this._node=L;F._instances[K]=this;this._stateProxy=L;if(this._initPlugins){this._initPlugins();}},J=function(L){var K=null;if(L){K=(typeof L==="string")?function(M){return C.Selector.test(M,L);}:function(M){return L(F.get(M));};}return K;};F.NAME="Node";F.re_aria=/^(?:role$|aria-)/;F.DOM_EVENTS={abort:true,beforeunload:true,blur:true,change:true,click:true,close:true,command:true,contextmenu:true,drag:true,dragstart:true,dragenter:true,dragover:true,dragleave:true,dragend:true,drop:true,dblclick:true,error:true,focus:true,keydown:true,keypress:true,keyup:true,load:true,message:true,mousedown:true,mousemove:true,mouseout:true,mouseover:true,mouseup:true,mousemultiwheel:true,mousewheel:true,submit:true,mouseenter:true,mouseleave:true,scroll:true,reset:true,resize:true,select:true,textInput:true,unload:true};C.mix(F.DOM_EVENTS,C.Env.evt.plugins);F._instances={};F.getDOMNode=function(K){if(K){return(K.nodeType)?K:K._node||null;}return null;};F.scrubVal=function(L,K){if(K&&L){if(typeof L==="object"||typeof L==="function"){if(I in L||C.DOM.isWindow(L)){L=F.get(L);}else{if((L.item&&!L._nodes)||(L[0]&&L[0][I])){L=C.all(L);}}}}else{if(L===undefined){L=K;}}return L;};F.addMethod=function(K,M,L){if(K&&M&&typeof M==="function"){F.prototype[K]=function(){L=L||this;var O=C.Array(arguments),N;if(O[0]&&O[0] instanceof F){O[0]=O[0]._node;}if(O[1]&&O[1] instanceof F){O[1]=O[1]._node;}O.unshift(this._node);N=F.scrubVal(M.apply(L,O),this);return N;};}else{}};F.importMethod=function(M,K,L){if(typeof K==="string"){L=L||K;F.addMethod(L,M[K],M);}else{C.each(K,function(N){F.importMethod(M,N);});}};F.one=function(N){var K=null,M,L;if(N){if(typeof N==="string"){if(N.indexOf("doc")===0){N=C.config.doc;}else{if(N.indexOf("win")===0){N=C.config.win;}else{N=C.Selector.query(N,null,true);}}if(!N){return null;}}else{if(N instanceof F){return N;}}L=N._yuid;K=F._instances[L];M=K?K._node:null;if(!K||(M&&N!==M)){K=new F(N);}}return K;};F.get=function(){return F.one.apply(F,arguments);};F.create=function(){return F.get(C.DOM.create.apply(C.DOM,arguments));};F.ATTRS={text:{getter:function(){return C.DOM.getText(this._node);},setter:function(K){C.DOM.setText(this._node,K);return K;}},"options":{getter:function(){return this._node.getElementsByTagName("option");}},"elements":{getter:function(){return C.all(this._node.elements);}},"children":{getter:function(){var N=this._node,M=N.children,O,L,K;if(!M){O=N.childNodes;M=[];for(L=0,K=O.length;L<K;++L){if(O[L][H]){M[M.length]=O[L];}}}return M;}},value:{getter:function(){return C.DOM.getValue(this._node);},setter:function(K){C.DOM.setValue(this._node,K);return K;}},data:{getter:function(){return this._data;},setter:function(K){this._data=K;return K;}}};F.DEFAULT_SETTER=function(K,M){var L=this._stateProxy,N;if(K.indexOf(G)>-1){N=K;K=K.split(G);C.Object.setValue(L,K,M);}else{if(L[K]!==undefined){L[K]=M;}}return M;};F.DEFAULT_GETTER=function(K){var L=this._stateProxy,M;if(K.indexOf&&K.indexOf(G)>-1){M=C.Object.getValue(L,K.split(G));}else{if(L[K]!==undefined){M=L[K];}}return M;};C.augment(F,C.Event.Target);C.mix(F.prototype,{toString:function(){var M="",L=this[D]+": not bound to a node",K=this._node;if(K){M+=K[E];if(K.id){M+="#"+K.id;}if(K.className){M+="."+K.className.replace(" ",".");}M+=" "+this[D];}return M||L;},get:function(K){var L;if(this._getAttr){L=this._getAttr(K);}else{L=this._get(K);}if(L){L=C.Node.scrubVal(L,this);}return L;},_get:function(K){var L=F.ATTRS[K],M;if(L&&L.getter){M=L.getter.call(this);}else{if(F.re_aria.test(K)){M=this._node.getAttribute(K,2);}else{M=F.DEFAULT_GETTER.apply(this,arguments);}}return M;},set:function(K,M){var L=F.ATTRS[K];if(this._setAttr){this._setAttr(K,M);}else{if(L&&L.setter){L.setter.call(this,M);}else{if(F.re_aria.test(K)){this._node.setAttribute(K,M);}else{F.DEFAULT_SETTER.apply(this,arguments);}}}return this;},setAttrs:function(K){if(this._setAttrs){this._setAttrs(K);}else{C.Object.each(K,function(L,M){this.set(M,L);},this);}return this;},getAttrs:function(L){var K={};if(this._getAttrs){this._getAttrs(L);}else{C.Array.each(L,function(M,N){K[M]=this.get(M);},this);}return K;},create:F.create,compareTo:function(K){var L=this._node;if(K instanceof C.Node){K=K._node;}return L===K;},inDoc:function(L){var K=this._node;L=(L)?L._node||L:K[B];if(L.documentElement){return C.DOM.contains(L.documentElement,K);}},getById:function(M){var L=this._node,K=C.DOM.byId(M,L[B]);if(K&&C.DOM.contains(L,K)){K=C.get(K);}else{K=null;}return K;},ancestor:function(K){return F.get(C.DOM.elementByAxis(this._node,"parentNode",J(K)));},previous:function(L,K){return F.get(C.DOM.elementByAxis(this._node,"previousSibling",J(L),K));},next:function(M,L,K){return F.get(C.DOM.elementByAxis(this._node,"nextSibling",J(L),K));},one:function(K){return C.get(C.Selector.query(K,this._node,true));},query:function(K){return this.one(K);},all:function(K){return C.all(C.Selector.query(K,this._node));},queryAll:function(K){return this.all(K);},test:function(K){return C.Selector.test(this._node,K);},remove:function(K){var L=this._node;L.parentNode.removeChild(L);if(K){this.destroy(true);}return this;},replace:function(K){var L=this._node;L.parentNode.replaceChild(K,L);return this;},purge:function(L,K){C.Event.purgeElement(this._node,L,K);},destroy:function(K){delete F._instances[this[D]];if(K){this.purge(true);}if(this.unplug){this.unplug();}this._node._yuid=null;this._node=null;this._stateProxy=null;},invoke:function(R,L,K,Q,P,O){var N=this._node,M;if(L&&L instanceof C.Node){L=L._node;}if(K&&K instanceof C.Node){K=K._node;}M=N[R](L,K,Q,P,O);return C.Node.scrubVal(M,this);},each:function(L,K){K=K||this;return L.call(K,this);},item:function(K){return this;},size:function(){return this._node?1:0;},insert:function(M,K){var L=this._node;if(M){if(typeof K==="number"){K=this._node.childNodes[K];
}if(typeof M!=="string"){if(M._node){M=M._node;}else{if(M._nodes||(!M.nodeType&&M.length)){C.each(M._nodes,function(N){C.DOM.addHTML(L,N,K);});return this;}}}C.DOM.addHTML(L,M,K);}return this;},prepend:function(K){return this.insert(K,0);},append:function(K){return this.insert(K,null);},setContent:function(K){C.DOM.addHTML(this._node,K,"replace");return this;},hasMethod:function(L){var K=this._node;return(K&&(typeof K==="function"));}},true);C.Node=F;C.get=C.Node.get;C.one=C.Node.one;C.Array._diff=function(L,K){var P=[],R=false,N,M,Q,O;outer:for(N=0,Q=L.length;N<Q;N++){R=false;for(M=0,O=K.length;M<O;M++){if(L[N]===K[M]){R=true;continue outer;}}if(!R){P[P.length]=L[N];}}return P;};C.Array.diff=function(L,K){return{added:C.Array._diff(K,L),removed:C.Array._diff(L,K)};};var A=function(K){if(typeof K==="string"){this._query=K;K=C.Selector.query(K);}else{K=C.Array(K,0,true);}A._instances[C.stamp(this)]=this;this._nodes=K;};A.NAME="NodeList";A.getDOMNodes=function(K){return K._nodes;};A._instances=[];A.each=function(K,N,M){var L=K._nodes;if(L&&L.length){C.Array.each(L,N,M||K);}else{}};A.addMethod=function(K,M,L){if(K&&M){A.prototype[K]=function(){var O=[],N=arguments;C.Array.each(this._nodes,function(T){var S="_yuid",Q=C.Node._instances[T[S]],R,P;if(!Q){Q=A._getTempNode(T);}R=L||Q;P=M.apply(R,N);if(P!==undefined&&P!==Q){O[O.length]=P;}});return O.length?O:this;};}else{}};A.importMethod=function(M,K,L){if(typeof K==="string"){L=L||K;A.addMethod(K,M[K]);}else{C.each(K,function(N){A.importMethod(M,N);});}};A._getTempNode=function(L){var K=A._tempNode;if(!K){K=C.Node.create("<div></div>");A._tempNode=K;}K._node=L;K._stateProxy=L;return K;};C.mix(A.prototype,{item:function(K){return C.get((this._nodes||[])[K]);},each:function(M,L){var K=this;C.Array.each(this._nodes,function(O,N){O=C.get(O);return M.call(L||O,O,N,K);});return K;},batch:function(L,K){var M=this;C.Array.each(this._nodes,function(P,O){var N=C.Node._instances[P[D]];if(!N){N=A._getTempNode(P);}return L.call(K||N,N,O,M);});return M;},some:function(M,L){var K=this;return C.Array.some(this._nodes,function(O,N){O=C.get(O);L=L||O;return M.call(L,O,N,K);});},toFrag:function(){return C.get(C.DOM._nl2frag(this._nodes));},indexOf:function(K){return C.Array.indexOf(this._nodes,C.Node.getDOMNode(K));},filter:function(K){return C.all(C.Selector.filter(this._nodes,K));},modulus:function(M,L){L=L||0;var K=[];A.each(this,function(O,N){if(N%M===L){K.push(O);}});return C.all(K);},odd:function(){return this.modulus(2,1);},even:function(){return this.modulus(2);},destructor:function(){delete A._instances[this[D]];},refresh:function(){var L,K,M=this._nodes;if(this._query){if(M&&M[0]&&M[0].ownerDocument){L=M[0].ownerDocument;}this._nodes=C.Selector.query(this._query,L||C.config.doc);K=C.Array.diff(M,this._nodes);K.added=K.added?C.all(K.added):null;K.removed=K.removed?C.all(K.removed):null;this.fire("refresh",K);}return this;},on:function(Q,P,O,N,K,M){var L=C.Array(arguments,0,true);L.splice(2,0,this._nodes);L[2]=O||this;return C.on.apply(C,L);},after:function(O,N,M,L){var K=C.Array(arguments,0,true);K.splice(2,0,this._nodes);K[2]=M||this;return C.after.apply(C,K);},size:function(){return this._nodes.length;},toString:function(){var N="",M=this[D]+": not bound to any nodes",K=this._nodes,L;if(K&&K[0]){L=K[0];N+=L[E];if(L.id){N+="#"+L.id;}if(L.className){N+="."+L.className.replace(" ",".");}if(K.length>1){N+="...["+K.length+" items]";}}return N||M;}},true);A.importMethod(C.Node.prototype,["append","detach","detachAll","insert","prepend","remove","set","setContent"]);A.prototype.get=function(L){var O=[],N=this._nodes,M=false,P=A._getTempNode,K,Q;if(N[0]){K=C.Node._instances[N[0]._yuid]||P(N[0]);Q=K._get(L);if(Q&&Q.nodeType){M=true;}}C.Array.each(N,function(R){K=C.Node._instances[R._yuid];if(!K){K=P(R);}Q=K._get(L);if(!M){Q=C.Node.scrubVal(Q,K);}O.push(Q);});return(M)?C.all(O):O;};C.NodeList=A;C.all=function(K){return new A(K);};C.Node.all=C.all;C.Array.each(["replaceChild","appendChild","insertBefore","removeChild","hasChildNodes","cloneNode","hasAttribute","removeAttribute","scrollIntoView","getElementsByTagName","focus","blur","submit","reset","select"],function(K){C.Node.prototype[K]=function(O,M,L){var N=this.invoke(K,O,M,L);return N;};});F.importMethod(C.DOM,["contains","setAttribute","getAttribute"]);C.NodeList.importMethod(C.Node.prototype,["getAttribute","setAttribute"]);(function(L){var K=["hasClass","addClass","removeClass","replaceClass","toggleClass"];L.Node.importMethod(L.DOM,K);L.NodeList.importMethod(L.Node.prototype,K);})(C);if(!document.documentElement.hasAttribute){C.Node.prototype.hasAttribute=function(K){return C.DOM.getAttribute(this._node,K)!=="";};}C.Node.ATTRS.type={setter:function(L){if(L==="hidden"){try{this._node.type="hidden";}catch(K){this._node.style.display="none";}}return L;}};},"@VERSION@",{requires:["dom-base","selector-css2","event-base"]});YUI.add("node-style",function(A){(function(C){var B=["getStyle","getComputedStyle","setStyle","setStyles"];C.Node.importMethod(C.DOM,B);C.NodeList.importMethod(C.Node.prototype,B);})(A);},"@VERSION@",{requires:["dom-style","node-base"]});YUI.add("node-screen",function(A){A.each(["winWidth","winHeight","docWidth","docHeight","docScrollX","docScrollY"],function(B){A.Node.ATTRS[B]={getter:function(){var C=Array.prototype.slice.call(arguments);C.unshift(A.Node.getDOMNode(this));return A.DOM[B].apply(this,C);}};});A.Node.ATTRS.scrollLeft={getter:function(){var B=A.Node.getDOMNode(this);return("scrollLeft" in B)?B.scrollLeft:A.DOM.docScrollX(B);},setter:function(C){var B=A.Node.getDOMNode(this);if(B){if("scrollLeft" in B){B.scrollLeft=C;}else{if(B.document||B.nodeType===9){A.DOM._getWin(B).scrollTo(C,A.DOM.docScrollY(B));}}}else{}}};A.Node.ATTRS.scrollTop={getter:function(){var B=A.Node.getDOMNode(this);return("scrollTop" in B)?B.scrollTop:A.DOM.docScrollY(B);},setter:function(C){var B=A.Node.getDOMNode(this);if(B){if("scrollTop" in B){B.scrollTop=C;}else{if(B.document||B.nodeType===9){A.DOM._getWin(B).scrollTo(A.DOM.docScrollX(B),C);
}}}else{}}};A.Node.importMethod(A.DOM,["getXY","setXY","getX","setX","getY","setY"]);A.Node.ATTRS.region={getter:function(){var B=A.Node.getDOMNode(this);if(B&&!B.tagName){if(B.nodeType===9){B=B.documentElement;}else{if(B.alert){B=B.document.documentElement;}}}return A.DOM.region(B);}};A.Node.ATTRS.viewportRegion={getter:function(){return A.DOM.viewportRegion(A.Node.getDOMNode(this));}};A.Node.importMethod(A.DOM,"inViewportRegion");A.Node.prototype.intersect=function(B,D){var C=A.Node.getDOMNode(this);if(B instanceof A.Node){B=A.Node.getDOMNode(B);}return A.DOM.intersect(C,B,D);};A.Node.prototype.inRegion=function(B,D,E){var C=A.Node.getDOMNode(this);if(B instanceof A.Node){B=A.Node.getDOMNode(B);}return A.DOM.inRegion(C,B,D,E);};},"@VERSION@",{requires:["dom-screen"]});YUI.add("node-pluginhost",function(A){A.Node.plug=function(){var B=A.Array(arguments);B.unshift(A.Node);A.Plugin.Host.plug.apply(A.Base,B);return A.Node;};A.Node.unplug=function(){var B=A.Array(arguments);B.unshift(A.Node);A.Plugin.Host.unplug.apply(A.Base,B);return A.Node;};A.mix(A.Node,A.Plugin.Host,false,null,1);A.NodeList.prototype.plug=function(){var B=arguments;A.NodeList.each(this,function(C){A.Node.prototype.plug.apply(A.get(C),B);});};A.NodeList.prototype.unplug=function(){var B=arguments;A.NodeList.each(this,function(C){A.Node.prototype.unplug.apply(A.get(C),B);});};},"@VERSION@",{requires:["node-base","pluginhost"]});YUI.add("node-event-delegate",function(A){A.Node.prototype.delegate=function(F,E,B){var D=Array.prototype.slice.call(arguments,3),C=[F,E,A.Node.getDOMNode(this),B];C=C.concat(D);return A.delegate.apply(A,C);};},"@VERSION@",{requires:["node-base","event-delegate","pluginhost"]});YUI.add("node",function(A){},"@VERSION@",{skinnable:false,use:["node-base","node-style","node-screen","node-pluginhost","node-event-delegate"],requires:["dom","event-base","event-delegate","pluginhost"]});