dom-base-min.js revision db445e900d0225be4de71ea099e90c2a0ad12921
YUI.add("dom-base",function(d){(function(h){var o="nodeType",s="ownerDocument",t="documentElement",g="defaultView",m="parentWindow",q="tagName",k="parentNode",e="firstChild",r="previousSibling",u="nextSibling",l="contains",p="compareDocumentPosition",f="",i=[],w=h.config.doc.documentElement,n=/<([a-z]+)/i,j=function(z,x){var A=h.config.doc.createElement("div"),y=true;A.innerHTML=z;if(!A.firstChild||A.firstChild.tagName!==x){y=false;}return y;},v={byId:function(y,x){return v.allById(y,x)[0]||null;},getText:(w.textContent!==undefined)?function(y){var x="";if(y){x=y.textContent;}return x||"";}:function(y){var x="";if(y){x=y.innerText||y.nodeValue;}return x||"";},setText:(w.textContent!==undefined)?function(x,y){if(x){x.textContent=y;}}:function(x,y){if("innerText" in x){x.innerText=y;}else{if("nodeValue" in x){x.nodeValue=y;}}},ancestor:function(y,z,A){var x=null;if(A){x=(!z||z(y))?y:null;}return x||v.elementByAxis(y,k,z,null);},ancestors:function(z,A,B){var y=v.ancestor.apply(v,arguments),x=(y)?[y]:[];while((y=v.ancestor(y,A))){if(y){x.unshift(y);}}return x;},elementByAxis:function(x,A,z,y){while(x&&(x=x[A])){if((y||x[q])&&(!z||z(x))){return x;}}return null;},contains:function(y,z){var x=false;if(!z||!y||!z[o]||!y[o]){x=false;}else{if(y[l]){if(h.UA.opera||z[o]===1){x=y[l](z);}else{x=v._bruteContains(y,z);}}else{if(y[p]){if(y===z||!!(y[p](z)&16)){x=true;}}}}return x;},inDoc:function(z,A){var y=false,x;if(z&&z.nodeType){(A)||(A=z[s]);x=A[t];if(x&&x.contains&&z.tagName){y=x.contains(z);}else{y=v.contains(x,z);}}return y;},allById:function(C,x){x=x||h.config.doc;var y=[],z=[],A,B;if(x.querySelectorAll){z=x.querySelectorAll('[id="'+C+'"]');}else{if(x.all){y=x.all(C);if(y){if(y.nodeName){if(y.id===C){z.push(y);y=i;}else{y=[y];}}if(y.length){for(A=0;B=y[A++];){if(B.id===C||(B.attributes&&B.attributes.id&&B.attributes.id.value===C)){z.push(B);}}}}}else{z=[v._getDoc(x).getElementById(C)];}}return z;},create:function(B,E){if(typeof B==="string"){B=h.Lang.trim(B);}E=E||h.config.doc;var A=n.exec(B),C=v._create,y=v.creators,D=null,z,F,x;if(B!=undefined){if(A&&A[1]){z=y[A[1].toLowerCase()];if(typeof z==="function"){C=z;}else{F=z;}}x=C(B,E,F).childNodes;if(x.length===1){D=x[0].parentNode.removeChild(x[0]);}else{if(x[0]&&x[0].className==="yui3-big-dummy"){if(x.length===2){D=x[0].nextSibling;}else{x[0].parentNode.removeChild(x[0]);D=v._nl2frag(x,E);}}else{D=v._nl2frag(x,E);}}}return D;},_nl2frag:function(y,B){var z=null,A,x;if(y&&(y.push||y.item)&&y[0]){B=B||y[0].ownerDocument;z=B.createDocumentFragment();if(y.item){y=h.Array(y,0,true);}for(A=0,x=y.length;A<x;A++){z.appendChild(y[A]);}}return z;},CUSTOM_ATTRIBUTES:(!w.hasAttribute)?{"for":"htmlFor","class":"className"}:{"htmlFor":"for","className":"class"},setAttribute:function(z,x,A,y){if(z&&x&&z.setAttribute){x=v.CUSTOM_ATTRIBUTES[x]||x;z.setAttribute(x,A,y);}},getAttribute:function(A,x,z){z=(z!==undefined)?z:2;var y="";if(A&&x&&A.getAttribute){x=v.CUSTOM_ATTRIBUTES[x]||x;y=A.getAttribute(x,z);if(y===null){y="";}}return y;},isWindow:function(x){return !!(x&&x.alert&&x.document);},_fragClones:{},_create:function(y,z,x){x=x||"div";var A=v._fragClones[x];if(A){A=A.cloneNode(false);}else{A=v._fragClones[x]=z.createElement(x);}A.innerHTML=y;return A;},_removeChildNodes:function(x){while(x.firstChild){x.removeChild(x.firstChild);}},addHTML:function(E,D,z){var x=E.parentNode,B=0,C,y=D,A;if(D!=undefined){if(D.nodeType){A=D;}else{if(typeof D=="string"||typeof D=="number"){y=A=v.create(D);}else{if(D[0]&&D[0].nodeType){A=h.config.doc.createDocumentFragment();while((C=D[B++])){A.appendChild(C);}}}}}if(z){if(z.nodeType){z.parentNode.insertBefore(A,z);}else{switch(z){case"replace":while(E.firstChild){E.removeChild(E.firstChild);}if(A){E.appendChild(A);}break;case"before":x.insertBefore(A,E);break;case"after":if(E.nextSibling){x.insertBefore(A,E.nextSibling);}else{x.appendChild(A);}break;default:E.appendChild(A);}}}else{if(A){E.appendChild(A);}}return y;},VALUE_SETTERS:{},VALUE_GETTERS:{},getValue:function(z){var y="",x;if(z&&z[q]){x=v.VALUE_GETTERS[z[q].toLowerCase()];if(x){y=x(z);}else{y=z.value;}}if(y===f){y=f;}return(typeof y==="string")?y:"";},setValue:function(x,y){var z;if(x&&x[q]){z=v.VALUE_SETTERS[x[q].toLowerCase()];if(z){z(x,y);}else{x.value=y;}}},siblings:function(A,z){var x=[],y=A;while((y=y[r])){if(y[q]&&(!z||z(y))){x.unshift(y);}}y=A;while((y=y[u])){if(y[q]&&(!z||z(y))){x.push(y);}}return x;},_bruteContains:function(x,y){while(y){if(x===y){return true;}y=y.parentNode;}return false;},_getRegExp:function(y,x){x=x||"";v._regexCache=v._regexCache||{};if(!v._regexCache[y+x]){v._regexCache[y+x]=new RegExp(y,x);}return v._regexCache[y+x];},_getDoc:function(x){var y=h.config.doc;if(x){y=(x[o]===9)?x:x[s]||x.document||h.config.doc;}return y;},_getWin:function(x){var y=v._getDoc(x);return y[g]||y[m]||h.config.win;},_batch:function(x,G,D,C,B,z){G=(typeof G==="string")?v[G]:G;var H,F=Array.prototype.slice.call(arguments,2),A=0,y,E;if(G&&x){while((y=x[A++])){H=H=G.call(v,y,D,C,B,z);if(typeof H!=="undefined"){(E)||(E=[]);E.push(H);}}}return(typeof E!=="undefined")?E:x;},wrap:function(A,y){var z=h.DOM.create(y),x=z.getElementsByTagName("*");if(x.length){z=x[x.length-1];}if(A.parentNode){A.parentNode.replaceChild(z,A);}z.appendChild(A);},unwrap:function(A){var y=A.parentNode,z=y.lastChild,A=y.firstChild,x=A,B;if(y){B=y.parentNode;if(B){while(A!==z){x=A.nextSibling;B.insertBefore(A,y);A=x;}B.replaceChild(z,y);}else{y.removeChild(A);}}},generateID:function(x){var y=x.id;if(!y){y=h.stamp(x);x.id=y;}return y;},creators:{}};(function(B){var C=v.creators,x=v.create,A=/(?:\/(?:thead|tfoot|tbody|caption|col|colgroup)>)+\s*<tbody/,z="<table>",y="</table>";if(B.UA.ie&&B.UA.ie<9){B.mix(C,{tbody:function(E,F){var G=x(z+E+y,F),D=G.children.tags("tbody")[0];if(G.children.length>1&&D&&!A.test(E)){D[k].removeChild(D);}return G;},script:function(D,E){var F=E.createElement("div");F.innerHTML="-"+D;F.removeChild(F[e]);return F;}},true);B.mix(v.VALUE_GETTERS,{button:function(D){return(D.attributes&&D.attributes.value)?D.attributes.value.value:"";
}});B.mix(v.VALUE_SETTERS,{button:function(E,F){var D=E.attributes.value;if(!D){D=E[s].createAttribute("value");E.setAttributeNode(D);}D.value=F;},select:function(G,H){for(var E=0,D=G.getElementsByTagName("option"),F;F=D[E++];){if(v.getValue(F)===H){v.setAttribute(F,"selected",true);break;}}}});v.creators.col=v.creators.link=v.creators.style=v.creators.script;}if(!j("<tr/>","TR")){B.mix(C,{option:function(D,E){return x('<select><option class="yui3-big-dummy" selected></option>'+D+"</select>",E);},tr:function(D,E){return x("<tbody>"+D+"</tbody>",E);},td:function(D,E){return x("<tr>"+D+"</tr>",E);},col:function(D,E){return x("<colgroup>"+D+"</colgroup>",E);},tbody:"table"});B.mix(C,{legend:"fieldset",th:C.td,thead:C.tbody,tfoot:C.tbody,caption:C.tbody,colgroup:C.tbody,optgroup:C.option});}B.mix(v.VALUE_GETTERS,{option:function(E){var D=E.attributes;return(D.value&&D.value.specified)?E.value:E.text;},select:function(E){var F=E.value,D=E.options;if(D&&D.length&&F===""){if(E.multiple){}else{F=v.getValue(D[E.selectedIndex]);}}return F;}});})(h);h.DOM=v;})(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"]});