dom-base-min.js revision 45411eef9a56441369baf37f93779e0eb0a8bf90
YUI.add("dom-base",function(D){var J="nodeType",O="ownerDocument",S="documentElement",C="defaultView",I="parentWindow",M="tagName",F="parentNode",B="firstChild",R="lastChild",N="previousSibling",T="nextSibling",G="contains",K="compareDocumentPosition",P="innerText",Q="textContent",L="length",U=undefined;var H=/<([a-z]+)/i;var E={};D.DOM={byId:function(W,V){return D.DOM._getDoc(V).getElementById(W);},getText:function(V){var W=V?V[Q]:"";if(W===U&&P in V){W=V[P];}return W||"";},firstChild:function(V,W){return D.DOM._childBy(V,null,W);},firstChildByTag:function(W,V,X){return D.DOM._childBy(W,V,X);},lastChild:function(V,W){return D.DOM._childBy(V,null,W,true);},lastChildByTag:function(W,V,X){return D.DOM._childBy(W,V,X,true);},_childrenByTag:function(){if(document[S].children){return function(Y,W,Z,X){W=(W&&W!=="*")?W:null;var a=[],V=Z;if(Y){if(W&&!D.UA.webkit){a=Y.children.tags(W);}else{V=function(b){return b[M].toUpperCase()===W&&(!Z||Z(b));};}if(Z||X){a=D.DOM.filterElementsBy(a,V);}}return a;};}else{return function(X,W,Y){W=(W&&W!=="*")?W.toUpperCase():null;var Z=[],V=Y;if(X){Z=X.childNodes;if(W){V=function(a){return a[M].toUpperCase()===W&&(!Y||Y(a));};}Z=D.DOM.filterElementsBy(Z,V);}return Z;};}}(),children:function(V,W){return D.DOM._childrenByTag(V,null,W);},previous:function(V,X,W){return D.DOM.elementByAxis(V,N,X,W);},next:function(V,X,W){return D.DOM.elementByAxis(V,T,X,W);},ancestor:function(V,X,W){return D.DOM.elementByAxis(V,F,X,W);},elementByAxis:function(V,Y,X,W){while(V&&(V=V[Y])){if((W||V[M])&&(!X||X(V))){return V;}}return null;},byTag:function(W,X,a){X=X||D.config.doc;var b=X.getElementsByTagName(W),Z=[];for(var Y=0,V=b[L];Y<V;++Y){if(!a||a(b[Y])){Z[Z[L]]=b[Y];}}return Z;},firstByTag:function(W,X,a){X=X||D.config.doc;var b=X.getElementsByTagName(W),Y=null;for(var Z=0,V=b[L];Z<V;++Z){if(!a||a(b[Z])){Y=b[Z];break;}}return Y;},filterElementsBy:function(a,Z,Y){var W=(Y)?null:[];for(var X=0,V=a[L];X<V;++X){if(a[X][M]&&(!Z||Z(a[X]))){if(Y){W=a[X];break;}else{W[W[L]]=a[X];}}}return W;},contains:function(W,X){var V=false;if(!X||!W||!X[J]||!W[J]){V=false;}else{if(W[G]){if(D.UA.opera||X[J]===1){V=W[G](X);}else{V=D.DOM._bruteContains(W,X);}}else{if(W[K]){if(W===X||!!(W[K](X)&16)){V=true;}}}}return V;},inDoc:function(V,W){W=W||D.config.doc;return D.DOM.contains(W.documentElement,V);},create:function(Z,b){b=b||D.config.doc;var W=H.exec(Z);var Y=D.DOM._create,a=D.DOM.creators,V,X;if(W&&a[W[1]]){if(typeof a[W[1]]==="function"){Y=a[W[1]];}else{V=a[W[1]];}}X=Y(Z,b,V);return(X.childNodes.length>1)?X.childNodes:X.childNodes[0];},CUSTOM_ATTRIBUTES:(!document.documentElement.hasAttribute)?{"for":"htmlFor","class":"className"}:{"htmlFor":"for","className":"class"},setAttribute:function(W,V,X){V=D.DOM.CUSTOM_ATTRIBUTES[V]||V;W.setAttribute(V,X);},getAttribute:function(X,V){V=D.DOM.CUSTOM_ATTRIBUTES[V]||V;var W=X.getAttribute(V);if(!document.documentElement.hasAttribute){if(X.getAttributeNode){W=X.getAttributeNode(V);W=(W)?W.value:null;}else{W=X.getAttribute(V);}}if(W===null){W="";}return W;},srcIndex:(document.documentElement.sourceIndex)?function(V){return(V&&V.sourceIndex)?V.sourceIndex:null;}:function(V){return(V&&V[O])?[].indexOf.call(V[O].getElementsByTagName("*"),V):null;},_create:function(W,X,V){V=V||"div";var Y=E[V]||X.createElement(V);Y.innerHTML=D.Lang.trim(W);return Y;},_bruteContains:function(V,W){while(W){if(V===W){return true;}W=W.parentNode;}return false;},_getRegExp:function(W,V){V=V||"";D.DOM._regexCache=D.DOM._regexCache||{};if(!D.DOM._regexCache[W+V]){D.DOM._regexCache[W+V]=new RegExp(W,V);}return D.DOM._regexCache[W+V];},_getDoc:function(V){V=V||{};return(V[J]===9)?V:V[O]||V.document||D.config.doc;},_getWin:function(V){var W=D.DOM._getDoc(V);return W[C]||W[I]||D.config.win;},_childBy:function(Z,V,b,X){var Y=null,W,a;if(Z){if(X){W=Z[R];a=N;}else{W=Z[B];a=T;}if(D.DOM._testElement(W,V,b)){Y=W;}else{Y=D.DOM.elementByAxis(W,a,b);}}return Y;},_testElement:function(W,V,X){V=(V&&V!=="*")?V.toUpperCase():null;return(W&&W[M]&&(!V||W[M].toUpperCase()===V)&&(!X||X(W)));},creators:{},_IESimpleCreate:function(V,W){W=W||D.config.doc;return W.createElement(V);}};(function(){var Z=D.DOM.creators,V=D.DOM.create,Y=/(?:\/(?:thead|tfoot|tbody|caption|col|colgroup)>)+\s*<tbody/;var X="<table>",W="</table>";if(D.UA.gecko||D.UA.ie){D.mix(Z,{option:function(a,b){var c=V("<select>"+a+"</select>");return c;},tr:function(a,b){var c=Z.tbody("<tbody>"+a+"</tbody>",b);return c.firstChild;},td:function(a,b){var c=Z.tr("<tr>"+a+"</tr>",b);return c.firstChild;},tbody:function(a,b){var c=V(X+a+W,b);return c;},legend:"fieldset"});Z.col=Z.tbody;}if(D.UA.ie){Z.col=Z.script=Z.link=D.DOM._IESimpleCreate;Z.tbody=function(b,c){var d=V(X+b+W,c);var a=d.children.tags("tbody")[0];if(d.children.length>1&&a&&!Y.test(b)){a.parentNode.removeChild(a);}return d;};}if(D.UA.gecko||D.UA.ie){D.mix(Z,{th:Z.td,thead:Z.tbody,tfoot:Z.tbody,caption:Z.tbody,colgroup:Z.tbody,col:Z.tbody,optgroup:Z.option});}})();var A="className";D.mix(D.DOM,{hasClass:function(X,W){var V=D.DOM._getRegExp("(?:^|\\s+)"+W+"(?:\\s+|$)");return V.test(X[A]);},addClass:function(W,V){if(!D.DOM.hasClass(W,V)){W[A]=D.Lang.trim([W[A],V].join(" "));}},removeClass:function(W,V){if(V&&D.DOM.hasClass(W,V)){W[A]=D.Lang.trim(W[A].replace(D.DOM._getRegExp("(?:^|\\s+)"+V+"(?:\\s+|$)")," "));if(D.DOM.hasClass(W,V)){D.DOM.removeClass(W,V);}}},replaceClass:function(W,V,X){D.DOM.addClass(W,X);D.DOM.removeClass(W,V);},toggleClass:function(W,V){if(D.DOM.hasClass(W,V)){D.DOM.removeClass(W,V);}else{D.DOM.addClass(W,V);}}});},"@VERSION@",{requires:["event"],skinnable:false});