node-min.js revision ce943fdfc59924e63f4e454dd3d1bd8c751827f4
YUI.add("node-base",function(D){var M={},J={},H=Array.prototype.slice,G=".",E="nodeName",K="nodeType",B="ownerDocument",I="tagName",C="_yuid",F=function(O){var N=O[C];if(N&&M[N]&&M[N]!==O){O[C]=null;}this._initPlugins();N=D.stamp(O);if(!N){N=D.guid();}this[C]=N;this._conf={};M[N]=O;this._node=O;this._stateProxy=O;F._instances[N]=this;},L=function(O){var N=null;if(O){N=(typeof O==="string")?function(P){return D.Selector.test(P,O);}:function(P){return O(F.get(P));};}return N;};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,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};D.mix(F.DOM_EVENTS,D.Env.evt.plugins);F._instances={};F.plug=function(){var N=H.call(arguments,0);N.unshift(F);D.Plugin.Host.plug.apply(D.Base,N);return F;};F.unplug=function(){var N=H.call(arguments,0);N.unshift(F);D.Plugin.Host.unplug.apply(D.Base,N);return F;};F.getDOMNode=function(N){if(N){return(N.nodeType)?N:N._node||null;}return null;};F.scrubVal=function(O,N){if(N&&O){if(typeof O==="object"||typeof O==="function"){if(K in O||D.DOM.isWindow(O)){O=F.get(O);}else{if(O.item||(O[0]&&O[0][K])){O=D.all(O);}}}}else{if(O===undefined){O=N;}}return O;};F.addMethod=function(N,P,O){if(N&&P&&typeof P==="function"){F.prototype[N]=function(){O=O||this;var R=H.call(arguments),Q;if(R[0]&&R[0] instanceof F){R[0]=R[0]._node;}if(R[1]&&R[1] instanceof F){R[1]=R[1]._node;}R.unshift(this._node);Q=F.scrubVal(P.apply(O,R),this);return Q;};}else{}};F.importMethod=function(P,N,O){if(typeof N==="string"){O=O||N;F.addMethod(O,P[N],P);}else{D.each(N,function(Q){F.importMethod(P,Q);});}};F.get=function(Q,R){var N=null,P,O;if(Q){if(typeof Q==="string"){if(Q.indexOf("doc")===0){Q=D.config.doc;}else{if(Q.indexOf("win")===0){Q=D.config.win;}else{Q=D.Selector.query(Q,R,true);}}if(!Q){return null;}}else{if(Q instanceof F){return Q;}}O=Q._yuid;N=F._instances[O];P=N?N._node:null;if(!N||(P&&Q!==P)){N=new F(Q);}}return N;};F.create=function(){return F.get(D.DOM.create.apply(D.DOM,arguments));};F.ATTRS={text:{getter:function(){return D.DOM.getText(this._node);},setter:function(N){D.DOM.setText(this._node,N);return N;}},"options":{getter:function(){return this.getElementsByTagName("option");}},"options":{getter:function(){return this.getElementsByTagName("option");}},"children":{getter:function(){var Q=this._node,P=Q.children,R,O,N;if(!P){R=Q.childNodes;P=[];for(O=0,N=R.length;O<N;++O){if(R[O][I]){P[P.length]=R[O];}}}return D.all(P);}},value:{getter:function(){return D.DOM.getValue(this._node);},setter:function(N){D.DOM.setValue(this._node,N);return N;}},getter:function(){return this._data;},setter:function(N){this._data=N;return N;}};F.DEFAULT_SETTER=function(N,P){var O=this._stateProxy,Q;if(N.indexOf(G)>-1){Q=N;N=N.split(G);D.Object.setValue(O,N,P);}else{if(O[N]!==undefined){O[N]=P;}}return P;};F.DEFAULT_GETTER=function(N){var O=this._stateProxy,P;if(N.indexOf&&N.indexOf(G)>-1){P=D.Object.getValue(O,N.split(G));}else{if(O[N]!==undefined){P=O[N];}}return P?D.Node.scrubVal(P,this):P;};D.augment(F,D.Event.Target);D.augment(F,D.Plugin.Host);D.mix(F.prototype,{toString:function(){var P="",O=this[C]+": not bound to a node",N=this._node;if(N){P+=N[E];if(N.id){P+="#"+N.id;}if(N.className){P+="."+N.className.replace(" ",".");}P+=" "+this[C];}return P||O;},get:function(N){var O=F.ATTRS[N],P;if(O&&O.getter){P=O.getter.call(this);}else{if(F.re_aria.test(N)){P=this._node.getAttribute(N,2);}else{P=F.DEFAULT_GETTER.apply(this,arguments);}}return P;},set:function(N,P){var O=F.ATTRS[N];if(O&&O.setter){O.setter.call(this,P);}else{if(F.re_aria.test(N)){this._node.setAttribute(N,P);}else{F.DEFAULT_SETTER.apply(this,arguments);}}return this;},create:F.create,compareTo:function(N){var O=this._node;if(N instanceof D.Node){N=N._node;}return O===N;},inDoc:function(O){var N=this._node;O=(O)?O._node||O:N[B];if(O.documentElement){return D.DOM.contains(O.documentElement,N);}},getById:function(P){var O=this._node,N=D.DOM.byId(P,O[B]);if(N&&D.DOM.contains(O,N)){N=D.get(N);}else{N=null;}return N;},ancestor:function(N){return F.get(D.DOM.elementByAxis(this._node,"parentNode",L(N)));},previous:function(O,N){return F.get(D.DOM.elementByAxis(this._node,"previousSibling",L(O),N));},next:function(P,O,N){return F.get(D.DOM.elementByAxis(this._node,"nextSibling",L(O),N));},query:function(N){return D.get(D.Selector.query(N,this._node,true));},queryAll:function(N){return D.all(D.Selector.query(N,this._node));},test:function(N){return D.Selector.test(this._node,N);},remove:function(){var N=this._node;N.parentNode.removeChild(N);return this;},replace:function(N){var O=this._node;O.parentNode.replaceChild(N,O);return this;},invoke:function(U,O,N,T,S,R){var Q=this._node,P;if(O&&O instanceof D.Node){O=O._node;}if(N&&N instanceof D.Node){N=N._node;}P=Q[U](O,N,T,S,R);return D.Node.scrubVal(P,this);},destructor:function(){},each:function(O,N){N=N||this;return O.call(N,this);},item:function(N){return this;},size:function(){return this._node?1:0;},insert:function(O,N){if(O){if(typeof N==="number"){N=this._node.childNodes[N];}if(O._node){O=O._node;}D.DOM.addHTML(this._node,O,N);}return this;},prepend:function(N){return this.insert(N,0);},append:function(N){return this.insert(N,null);},setContent:function(N){D.DOM.addHTML(this._node,N,"replace");return this;},hasMethod:function(O){var N=this._node;return(N&&(typeof N==="function"));}},true);D.Node=F;D.get=D.Node.get;D.first=D.Node.get;D.Array._diff=function(O,N){var S=[],U=false,Q,P,T,R;outer:for(Q=0,T=O.length;Q<T;Q++){U=false;for(P=0,R=N.length;P<R;P++){if(O[Q]===N[P]){U=true;continue outer;}}if(!U){S[S.length]=O[Q];
}}return S;};D.Array.diff=function(O,N){return{added:D.Array._diff(N,O),removed:D.Array._diff(O,N)};};var A=function(O){var N=O.nodes||[],P=O.doc||D.config.doc;if(typeof N==="string"){this._query=N;N=D.Selector.query(N,P);}D.stamp(this);A._instances[this[C]]=this;J[this[C]]=N;};A.NAME="NodeList";A.getDOMNodes=function(N){return J[N[C]];};A._instances=[];A.each=function(N,Q,P){var O=J[N[C]];if(O&&O.length){D.Array.each(O,Q,P||N);}else{}};A.addMethod=function(N,Q,P){var O=A._getTempNode();if(N&&Q){A.prototype[N]=function(){var S=[],R=arguments;D.Array.each(J[this[C]],function(X){var W="_yuid",U=D.Node._instances[X[W]],V,T;if(!U){M[O[W]]=X;U=O;}V=P||U;T=Q.apply(V,R);if(T!==undefined&&T!==U){S[S.length]=T;}});return S.length?S:this;};}else{}};A.importMethod=function(P,N,O){if(typeof N==="string"){O=O||N;A.addMethod(N,P[N]);}else{D.each(N,function(Q){A.importMethod(P,Q);});}};A._getTempNode=function(){var N=A._tempNode;if(!N){N=D.Node.create("<div></div>");A._tempNode=N;}return N;};D.mix(A.prototype,{item:function(N){return D.get((J[this[C]]||[])[N]);},each:function(P,O){var N=this;D.Array.each(J[this[C]],function(R,Q){R=D.get(R);return P.call(O||R,R,Q,N);});return N;},batch:function(P,O){var Q=this,N=A._getTempNode();D.Array.each(J[this[C]],function(T,S){var R=D.Node._instances[T[C]];if(!R){M[N[C]]=T;R=N;}return P.call(O||R,R,S,Q);});return Q;},some:function(P,O){var N=this;return D.Array.some(J[this[C]],function(R,Q){R=D.get(R);O=O||R;return P.call(O,R,Q,N);});},indexOf:function(N){return D.Array.indexOf(J[this[C]],D.Node.getDOMNode(N));},filter:function(N){return D.all(D.Selector.filter(J[this[C]],N));},modulus:function(P,O){O=O||0;var N=[];A.each(this,function(R,Q){if(Q%P===O){N.push(R);}});return D.all(N);},odd:function(){return this.modulus(2,1);},even:function(){return this.modulus(2);},destructor:function(){delete A._instances[this[C]];},refresh:function(){var O,N,P=J[this[C]];if(this._query){if(J[this[C]]&&J[this[C]][0]&&J[this[C]][0].ownerDocument){O=J[this[C]][0].ownerDocument;}J[this[C]]=D.Selector.query(this._query,O||D.config.doc);N=D.Array.diff(P,J[this[C]]);N.added=N.added?D.all(N.added):null;N.removed=N.removed?D.all(N.removed):null;this.fire("refresh",N);}return this;},on:function(Q,P,O,N){arguments[2]=O||this;this.batch(function(R){R.on.apply(R,arguments);});},after:function(Q,P,O,N){arguments[2]=O||this;this.batch(function(R){R.after.apply(R,arguments);});},size:function(){return J[this[C]].length;},get:function(O){var N=[],P=A._getTempNode();A.each(this,function(R){var Q=D.Node._instances[R[C]];if(!Q){M[P[C]]=R;Q=P;}N[N.length]=Q.get(O);});return N;},toString:function(){var Q="",P=this[C]+": not bound to any nodes",N=J[this[C]],O;if(N&&N[0]){O=N[0];Q+=O[E];if(O.id){Q+="#"+O.id;}if(O.className){Q+="."+O.className.replace(" ",".");}if(N.length>1){Q+="...["+N.length+" items]";}}return Q||P;}},true);A.importMethod(D.Node.prototype,["append","detach","detachAll","insert","plug","prepend","remove","set","setContent","unplug"]);D.NodeList=A;D.all=function(O,Q,N){var P=new A({nodes:O,doc:Q});return P;};D.Node.all=D.all;D.Array.each(["replaceChild","appendChild","insertBefore","removeChild","hasChildNodes","cloneNode","hasAttribute","removeAttribute","scrollIntoView","getElementsByTagName","focus","blur","submit","reset","select"],function(N){D.Node.prototype[N]=function(R,P,O){var Q=this.invoke(N,R,P,O);return Q;};});F.importMethod(D.DOM,["contains","setAttribute","getAttribute"]);if(!document.documentElement.hasAttribute){D.Node.prototype.hasAttribute=function(N){return D.DOM.getAttribute(D.Node.getDOMNode(this),N)!=="";};}D.NodeList.importMethod(D.Node.prototype,["getAttribute","setAttribute"]);(function(O){var N=["hasClass","addClass","removeClass","replaceClass","toggleClass"];O.Node.importMethod(O.DOM,N);O.NodeList.importMethod(O.Node.prototype,N);})(D);D.Node.prototype.delegate=function(S,R,N,Q){Q=Q||this;var P=Array.prototype.slice.call(arguments,4),O=["delegate",R,D.Node.getDOMNode(this),S,N,Q];O=O.concat(P);return D.on.apply(D,O);};},"@VERSION@",{requires:["dom-base","event-custom","selector-css2"]});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"]});