dom-base-min.js revision aab1eeae8965892252706bf128f878101c5a01b1
YUI.add("dom-base",function(D){(function(J){var T="nodeType",G="ownerDocument",F="documentElement",E="defaultView",L="parentWindow",O="tagName",Q="parentNode",S="firstChild",N="previousSibling",R="nextSibling",M="contains",I="compareDocumentPosition",H="",P=J.config.doc.documentElement,K=/<([a-z]+)/i;J.DOM={byId:function(V,U){return J.DOM.allById(V,U)[0]||null;},children:function(W,U){var V=[];if(W){U=U||"*";V=J.Selector.query("> "+U,W);}return V;},firstByTag:function(U,V){var W;V=V||J.config.doc;if(U&&V.getElementsByTagName){W=V.getElementsByTagName(U)[0];}return W||null;},getText:(P.textContent!==undefined)?function(V){var U="";if(V){U=V.textContent;}return U||"";}:function(V){var U="";if(V){U=V.innerText||V.nodeValue;}return U||"";},setText:(P.textContent!==undefined)?function(U,V){if(U){U.textContent=V;}}:function(U,V){if(U){U.innerText=V;}},previous:function(U,W,V){return J.DOM.elementByAxis(U,N,W,V);},next:function(U,W,V){return J.DOM.elementByAxis(U,R,W,V);},ancestor:function(V,W,X){var U=null;if(X){U=(!W||W(V))?V:null;}return U||J.DOM.elementByAxis(V,Q,W,null);},ancestors:function(W,X,Y){var V=J.DOM.ancestor.apply(J.DOM,arguments),U=(V)?[V]:[];while((V=J.DOM.ancestor(V,X))){if(V){U.unshift(V);}}return U;},elementByAxis:function(U,X,W,V){while(U&&(U=U[X])){if((V||U[O])&&(!W||W(U))){return U;}}return null;},contains:function(V,W){var U=false;if(!W||!V||!W[T]||!V[T]){U=false;}else{if(V[M]){if(J.UA.opera||W[T]===1){U=V[M](W);}else{U=J.DOM._bruteContains(V,W);}}else{if(V[I]){if(V===W||!!(V[I](W)&16)){U=true;}}}}return U;},inDoc:function(W,X){var V=false,U;if(W&&W.nodeType){(X)||(X=W[G]);U=X[F];if(U&&U.contains&&W.tagName){V=U.contains(W);}else{V=J.DOM.contains(U,W);}}return V;},allById:function(Z,U){U=U||J.config.doc;var V=[],W=[],X,Y;if(U.querySelectorAll){W=U.querySelectorAll('[id="'+Z+'"]');}else{if(U.all){V=U.all(Z);if(V&&V.nodeType){V=[V];}if(V&&V.length){for(X=0;Y=V[X++];){if(Y.attributes&&Y.attributes.id&&Y.attributes.id.value===Z){W.push(Y);}}}}else{W=[J.DOM._getDoc(U).getElementById(Z)];}}return W;},create:function(Z,b){if(typeof Z==="string"){Z=J.Lang.trim(Z);}b=b||J.config.doc;var V=K.exec(Z),Y=J.DOM._create,a=J.DOM.creators,X=null,U,W;if(Z!=undefined){if(V&&a[V[1]]){if(typeof a[V[1]]==="function"){Y=a[V[1]];}else{U=a[V[1]];}}W=Y(Z,b,U).childNodes;if(W.length===1){X=W[0].parentNode.removeChild(W[0]);}else{if(W[0]&&W[0].className==="yui3-big-dummy"){if(W.length===2){X=W[0].nextSibling;}else{W[0].parentNode.removeChild(W[0]);X=J.DOM._nl2frag(W,b);}}else{X=J.DOM._nl2frag(W,b);}}}return X;},_nl2frag:function(V,Y){var W=null,X,U;if(V&&(V.push||V.item)&&V[0]){Y=Y||V[0].ownerDocument;W=Y.createDocumentFragment();if(V.item){V=J.Array(V,0,true);}for(X=0,U=V.length;X<U;X++){W.appendChild(V[X]);}}return W;},CUSTOM_ATTRIBUTES:(!P.hasAttribute)?{"for":"htmlFor","class":"className"}:{"htmlFor":"for","className":"class"},setAttribute:function(W,U,X,V){if(W&&U&&W.setAttribute){U=J.DOM.CUSTOM_ATTRIBUTES[U]||U;W.setAttribute(U,X,V);}},getAttribute:function(X,U,W){W=(W!==undefined)?W:2;var V="";if(X&&U&&X.getAttribute){U=J.DOM.CUSTOM_ATTRIBUTES[U]||U;V=X.getAttribute(U,W);if(V===null){V="";}}return V;},isWindow:function(U){return !!(U&&U.alert&&U.document);},_fragClones:{},_create:function(V,W,U){U=U||"div";var X=J.DOM._fragClones[U];if(X){X=X.cloneNode(false);}else{X=J.DOM._fragClones[U]=W.createElement(U);}X.innerHTML=V;return X;},_removeChildNodes:function(U){while(U.firstChild){U.removeChild(U.firstChild);}},addHTML:function(Y,X,V){var U=Y.parentNode,W;if(X!==undefined&&X!==null){if(X.nodeType){W=X;}else{W=J.DOM.create(X);}}if(V){if(V.nodeType){V.parentNode.insertBefore(W,V);}else{switch(V){case"replace":while(Y.firstChild){Y.removeChild(Y.firstChild);}if(W){Y.appendChild(W);}break;case"before":U.insertBefore(W,Y);break;case"after":if(Y.nextSibling){U.insertBefore(W,Y.nextSibling);}else{U.appendChild(W);}break;default:Y.appendChild(W);}}}else{Y.appendChild(W);}return W;},VALUE_SETTERS:{},VALUE_GETTERS:{},getValue:function(W){var V="",U;if(W&&W[O]){U=J.DOM.VALUE_GETTERS[W[O].toLowerCase()];if(U){V=U(W);}else{V=W.value;}}if(V===H){V=H;}return(typeof V==="string")?V:"";},setValue:function(U,V){var W;if(U&&U[O]){W=J.DOM.VALUE_SETTERS[U[O].toLowerCase()];if(W){W(U,V);}else{U.value=V;}}},siblings:function(X,W){var U=[],V=X;while((V=V[N])){if(V[O]&&(!W||W(V))){U.unshift(V);}}V=X;while((V=V[R])){if(V[O]&&(!W||W(V))){U.push(V);}}return U;},_bruteContains:function(U,V){while(V){if(U===V){return true;}V=V.parentNode;}return false;},_getRegExp:function(V,U){U=U||"";J.DOM._regexCache=J.DOM._regexCache||{};if(!J.DOM._regexCache[V+U]){J.DOM._regexCache[V+U]=new RegExp(V,U);}return J.DOM._regexCache[V+U];},_getDoc:function(U){var V=J.config.doc;if(U){V=(U[T]===9)?U:U[G]||U.document||J.config.doc;}return V;},_getWin:function(U){var V=J.DOM._getDoc(U);return V[E]||V[L]||J.config.win;},_batch:function(U,d,a,Z,Y,W){d=(typeof d==="string")?J.DOM[d]:d;var e,c=Array.prototype.slice.call(arguments,2),X=0,V,b;if(d&&U){while((V=U[X++])){e=e=d.call(J.DOM,V,a,Z,Y,W);if(typeof e!=="undefined"){(b)||(b=[]);b.push(e);}}}return(typeof b!=="undefined")?b:U;},creators:{}};(function(Z){var a=Z.DOM.creators,U=Z.DOM.create,X=/(?:\/(?:thead|tfoot|tbody|caption|col|colgroup)>)+\s*<tbody/,W="<table>",V="</table>";if(Z.UA.ie){Z.mix(a,{tbody:function(b,c){var d=U(W+b+V,c),Y=d.children.tags("tbody")[0];if(d.children.length>1&&Y&&!X.test(b)){Y[Q].removeChild(Y);}return d;},script:function(Y,b){var c=b.createElement("div");c.innerHTML="-"+Y;c.removeChild(c[S]);return c;}},true);Z.mix(Z.DOM.VALUE_GETTERS,{button:function(Y){return(Y.attributes&&Y.attributes.value)?Y.attributes.value.value:"";}});Z.mix(Z.DOM.VALUE_SETTERS,{button:function(b,c){var Y=b.attributes.value;if(!Y){Y=b[G].createAttribute("value");b.setAttributeNode(Y);}Y.value=c;},select:function(d,e){for(var b=0,Y=d.getElementsByTagName("option"),c;c=Y[b++];){if(Z.DOM.getValue(c)===e){Z.DOM.setAttribute(c,"selected",true);break;}}}});Z.DOM.creators.col=Z.DOM.creators.link=Z.DOM.creators.style=Z.DOM.creators.script;
}if(Z.UA.gecko||Z.UA.ie){Z.mix(a,{option:function(Y,b){return U('<select><option class="yui3-big-dummy" selected></option>'+Y+"</select>",b);},tr:function(Y,b){return U("<tbody>"+Y+"</tbody>",b);},td:function(Y,b){return U("<tr>"+Y+"</tr>",b);},tbody:function(Y,b){return U(W+Y+V,b);}});Z.mix(a,{legend:"fieldset",th:a.td,thead:a.tbody,tfoot:a.tbody,caption:a.tbody,colgroup:a.tbody,col:a.tbody,optgroup:a.option});}Z.mix(Z.DOM.VALUE_GETTERS,{option:function(b){var Y=b.attributes;return(Y.value&&Y.value.specified)?b.value:b.text;},select:function(b){var c=b.value,Y=b.options;if(Y&&Y.length&&c===""){if(b.multiple){}else{c=Z.DOM.getValue(Y[b.selectedIndex]);}}return c;}});})(J);})(D);var B,A,C;D.mix(D.DOM,{hasClass:function(G,F){var E=D.DOM._getRegExp("(?:^|\\s+)"+F+"(?:\\s+|$)");return E.test(G.className);},addClass:function(F,E){if(!D.DOM.hasClass(F,E)){F.className=D.Lang.trim([F.className,E].join(" "));}},removeClass:function(F,E){if(E&&A(F,E)){F.className=D.Lang.trim(F.className.replace(D.DOM._getRegExp("(?:^|\\s+)"+E+"(?:\\s+|$)")," "));if(A(F,E)){C(F,E);}}},replaceClass:function(F,E,G){C(F,E);B(F,G);},toggleClass:function(F,E,G){var H=(G!==undefined)?G:!(A(F,E));if(H){B(F,E);}else{C(F,E);}}});A=D.DOM.hasClass;C=D.DOM.removeClass;B=D.DOM.addClass;D.mix(D.DOM,{setWidth:function(F,E){D.DOM._setSize(F,"width",E);},setHeight:function(F,E){D.DOM._setSize(F,"height",E);},_setSize:function(F,H,G){G=(G>0)?G:0;var E=0;F.style[H]=G+"px";E=(H==="height")?F.offsetHeight:F.offsetWidth;if(E>G){G=G-(E-G);if(G<0){G=0;}F.style[H]=G+"px";}}});},"@VERSION@",{requires:["oop"]});