dom-base-min.js revision c057f16cac82e00e17f15a6597f8538a990ad8d1
YUI.add("dom-base",function(D){var I="nodeType",N="ownerDocument",R="documentElement",C="defaultView",H="parentWindow",L="tagName",E="parentNode",B="firstChild",Q="lastChild",M="previousSibling",S="nextSibling",F="contains",J="compareDocumentPosition",O="innerText",P="textContent",K="length",T=undefined,G=/<([a-z]+)/i;D.DOM={byId:function(V,U){U=U||D.config.doc;return U.getElementById(V);},getText:function(U){var V=U?U[P]:"";if(V===T&&O in U){V=U[O];}return V||"";},firstChild:function(U,V){return D.DOM._childBy(U,null,V);},firstChildByTag:function(V,U,W){return D.DOM._childBy(V,U,W);},lastChild:function(U,V){return D.DOM._childBy(U,null,V,true);},lastChildByTag:function(V,U,W){return D.DOM._childBy(V,U,W,true);},_childrenByTag:function(){if(document[R].children){return function(X,V,Y,W){V=(V&&V!=="*")?V.toUpperCase():null;var Z=[],U=Y;if(X){if(V&&!D.UA.webkit){Z=X.children.tags(V);}else{Z=X.children;if(V){U=function(a){return a[L].toUpperCase()===V&&(!Y||Y(a));};}}Z=D.DOM.filterElementsBy(Z,U);}return Z;};}else{return function(W,V,X){V=(V&&V!=="*")?V.toUpperCase():null;var Y=[],U=X;if(W){Y=W.childNodes;if(V){U=function(Z){return Z[L].toUpperCase()===V&&(!X||X(Z));};}Y=D.DOM.filterElementsBy(Y,U);}return Y;};}}(),children:function(U,V){return D.DOM._childrenByTag(U,null,V);},previous:function(U,W,V){return D.DOM.elementByAxis(U,M,W,V);},next:function(U,W,V){return D.DOM.elementByAxis(U,S,W,V);},ancestor:function(U,W,V){return D.DOM.elementByAxis(U,E,W,V);},elementByAxis:function(U,X,W,V){while(U&&(U=U[X])){if((V||U[L])&&(!W||W(U))){return U;}}return null;},byTag:function(V,W,Z){W=W||D.config.doc;var a=W.getElementsByTagName(V),Y=[];for(var X=0,U=a[K];X<U;++X){if(!Z||Z(a[X])){Y[Y[K]]=a[X];}}return Y;},firstByTag:function(V,W,Z){W=W||D.config.doc;var a=W.getElementsByTagName(V),X=null;for(var Y=0,U=a[K];Y<U;++Y){if(!Z||Z(a[Y])){X=a[Y];break;}}return X;},filterElementsBy:function(Z,Y,X){var V=(X)?null:[];for(var W=0,U=Z[K];W<U;++W){if(Z[W][L]&&(!Y||Y(Z[W]))){if(X){V=Z[W];break;}else{V[V[K]]=Z[W];}}}return V;},contains:function(V,W){var U=false;if(!W||!V||!W[I]||!V[I]){U=false;}else{if(V[F]){if(D.UA.opera||W[I]===1){U=V[F](W);}else{U=D.DOM._bruteContains(V,W);}}else{if(V[J]){if(V===W||!!(V[J](W)&16)){U=true;}}}}return U;},inDoc:function(U,V){V=V||U[N];var W=U.id;if(!W){W=U.id=D.guid();}return !!(V.getElementById(W));},insertBefore:function(V,U){if(!V||!U||!U[E]){return null;}if(typeof V==="string"){V=DOM.create(V);}return U[E].insertBefore(V,U);},insertAfter:function(V,U){if(!V||!U||!U[E]){return null;}if(U[S]){return U[E].insertBefore(V,U[S]);}else{return U[E].appendChild(V);}},create:function(Z,b){b=b||D.config.doc;var V=G.exec(Z),Y=D.DOM._create,a=D.DOM.creators,X=null,U,W;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[K]===1){X=W[0].parentNode.removeChild(W[0]);}else{X=b.createDocumentFragment();while(W[K]){X.appendChild(W[W[K]-1]);}}return X;},CUSTOM_ATTRIBUTES:(!document.documentElement.hasAttribute)?{"for":"htmlFor","class":"className"}:{"htmlFor":"for","className":"class"},setAttribute:function(V,U,W){if(V&&V.setAttribute){U=D.DOM.CUSTOM_ATTRIBUTES[U]||U;V.setAttribute(U,W);}},getAttribute:function(W,U){var V="";if(W&&W.getAttribute){U=D.DOM.CUSTOM_ATTRIBUTES[U]||U;V=W.getAttribute(U,2);if(V===null){V="";}}return V;},srcIndex:(document.documentElement.sourceIndex)?function(U){return(U&&U.sourceIndex)?U.sourceIndex:null;}:function(U){return(U&&U[N])?[].indexOf.call(U[N].getElementsByTagName("*"),U):null;},isWindow:function(U){return U.alert&&U.document;},_create:function(V,W,U){U=U||"div";var X=W.createElement(U);X.innerHTML=D.Lang.trim(V);return X;},insertHTML:function(Y,X,V,Z){var U,W=D.DOM.create(X);switch(V){case"innerHTML":Y.innerHTML=X;W=Y;break;case"beforeBegin":D.DOM.insertBefore(W,Y);break;case"afterBegin":D.DOM.insertBefore(W,Y[B]);break;case"afterEnd":D.DOM.insertAfter(W,Y);break;default:Y.appendChild(W);}if(Z){if(W.nodeName.toUpperCase()==="SCRIPT"&&!D.UA.gecko){U=[W];}else{U=W.getElementsByTagName("script");}D.DOM._execScripts(U);}else{D.DOM._stripScripts(W);}return W;},VALUE_SETTERS:{},VALUE_GETTERS:{},getValue:function(W){var V="",U;if(W&&W[L]){U=D.DOM.VALUE_GETTERS[W[L].toLowerCase()];if(U){V=U(W);}else{V=W.value;}}return(typeof V==="string")?V:"";},setValue:function(U,V){var W;if(U&&U[L]){W=D.DOM.VALUE_SETTERS[U[L].toLowerCase()];if(W){W(U,V);}else{U.value=V;}}},_stripScripts:function(X){var U=X.getElementsByTagName("script");for(var W=0,V;V=U[W++];){V.parentNode.removeChild(V);}},_execScripts:function(U,Y){var W;Y=Y||0;for(var X=Y,V;V=U[X++];){W=V.ownerDocument.createElement("script");V.parentNode.replaceChild(W,V);if(V.text){W.text=V.text;}else{if(V.src){W.src=V.src;if(typeof W.onreadystatechange!=="undefined"){W.onreadystatechange=function(){if(/loaded|complete/.test(V.readyState)){event.srcElement.onreadystatechange=null;setTimeout(function(){D.DOM._execScripts(U,X++);},0);}};}else{W.onload=function(Z){Z.target.onload=null;D.DOM._execScripts(U,X++);};}return;}}}},_bruteContains:function(U,V){while(V){if(U===V){return true;}V=V.parentNode;}return false;},_getRegExp:function(V,U){U=U||"";D.DOM._regexCache=D.DOM._regexCache||{};if(!D.DOM._regexCache[V+U]){D.DOM._regexCache[V+U]=new RegExp(V,U);}return D.DOM._regexCache[V+U];},_getDoc:function(U){U=U||{};return(U[I]===9)?U:U[N]||U.document||D.config.doc;},_getWin:function(U){var V=D.DOM._getDoc(U);return V[C]||V[H]||D.config.win;},_childBy:function(Y,U,a,W){var X=null,V,Z;if(Y){if(W){V=Y[Q];Z=M;}else{V=Y[B];Z=S;}if(D.DOM._testElement(V,U,a)){X=V;}else{X=D.DOM.elementByAxis(V,Z,a);}}return X;},_testElement:function(V,U,W){U=(U&&U!=="*")?U.toUpperCase():null;return(V&&V[L]&&(!U||V[L].toUpperCase()===U)&&(!W||W(V)));},creators:{},_IESimpleCreate:function(U,V){V=V||D.config.doc;return V.createElement(U);}};(function(){var Y=D.DOM.creators,U=D.DOM.create,X=/(?:\/(?:thead|tfoot|tbody|caption|col|colgroup)>)+\s*<tbody/,W="<table>",V="</table>";if(D.UA.gecko||D.UA.ie){D.mix(Y,{option:function(Z,a){return U("<select>"+Z+"</select>",a);
},tr:function(Z,a){return U("<tbody>"+Z+"</tbody>",a);},td:function(Z,a){return U("<tr>"+Z+"</tr>",a);},tbody:function(Z,a){return U(W+Z+V,a);},legend:"fieldset"});Y.col=Y.tbody;}if(D.UA.ie){D.mix(Y,{tbody:function(a,b){var c=U(W+a+V,b),Z=c.children.tags("tbody")[0];if(c.children[K]>1&&Z&&!X.test(a)){Z[E].removeChild(Z);}return c;},script:function(Z,a){var b=a.createElement("div");b.innerHTML="-"+Z;b.removeChild(b[B]);return b;}},true);D.mix(D.DOM.VALUE_GETTERS,{button:function(Z){return(Z.attributes&&Z.attributes.value)?Z.attributes.value.value:"";}});D.mix(D.DOM.VALUE_SETTERS,{button:function(a,b){var Z=a.attributes["value"];if(!Z){Z=a[N].createAttribute("value");a.setAttributeNode(Z);}Z.value=b;}});}if(D.UA.gecko||D.UA.ie){D.mix(Y,{th:Y.td,thead:Y.tbody,tfoot:Y.tbody,caption:Y.tbody,colgroup:Y.tbody,col:Y.tbody,optgroup:Y.option});}D.mix(D.DOM.VALUE_GETTERS,{option:function(a){var Z=a.attributes;return(Z.value&&Z.value.specified)?a.value:a.text;},select:function(c){var d=c.value,Z=c.options,b,a;if(Z&&d===""){if(c.multiple){}else{d=D.DOM.getValue(Z[c.selectedIndex],"value");}}return d;}});})();var A="className";D.mix(D.DOM,{hasClass:function(W,V){var U=D.DOM._getRegExp("(?:^|\\s+)"+V+"(?:\\s+|$)");return U.test(W[A]);},addClass:function(V,U){if(!D.DOM.hasClass(V,U)){V[A]=D.Lang.trim([V[A],U].join(" "));}},removeClass:function(V,U){if(U&&D.DOM.hasClass(V,U)){V[A]=D.Lang.trim(V[A].replace(D.DOM._getRegExp("(?:^|\\s+)"+U+"(?:\\s+|$)")," "));if(D.DOM.hasClass(V,U)){D.DOM.removeClass(V,U);}}},replaceClass:function(V,U,W){D.DOM.addClass(V,W);D.DOM.removeClass(V,U);},toggleClass:function(V,U){if(D.DOM.hasClass(V,U)){D.DOM.removeClass(V,U);}else{D.DOM.addClass(V,U);}}});},"@VERSION@",{requires:["event"],skinnable:false});