YUI.add("node-base",function(Y){
var _1=".",_2="nodeName",_3="nodeType",_4="ownerDocument",_5="tagName",_6="_yuid",_7=function(_8){
var _9=_8[_6];
if(_9&&_7._instances[_9]&&_7._instances[_9]._node!==_8){
_8[_6]=null;
}
_9=Y.stamp(_8);
if(!_9){
_9=Y.guid();
}
this[_6]=_9;
this._node=_8;
_7._instances[_9]=this;
this._stateProxy=_8;
if(this._initPlugins){
this._initPlugins();
}
},_a=function(fn){
var _b=null;
if(fn){
_b=(typeof fn==="string")?function(n){
return Y.Selector.test(n,fn);
}:function(n){
return fn(_7.get(n));
};
}
return _b;
};
_7.NAME="Node";
_7.re_aria=/^(?:role$|aria-)/;
_7.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,message: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};
Y.mix(_7.DOM_EVENTS,Y.Env.evt.plugins);
_7._instances={};
_7.getDOMNode=function(_c){
if(_c){
return (_c.nodeType)?_c:_c._node||null;
}
return null;
};
_7.scrubVal=function(_d,_e){
if(_e&&_d){
if(typeof _d==="object"||typeof _d==="function"){
if(_3 in _d||Y.DOM.isWindow(_d)){
_d=_7.get(_d);
}else{
if((_d.item&&!_d._nodes)||(_d[0]&&_d[0][_3])){
_d=Y.all(_d);
}
}
}
}else{
if(_d===undefined){
_d=_e;
}
}
return _d;
};
_7.addMethod=function(_f,fn,_10){
if(_f&&fn&&typeof fn==="function"){
_7.prototype[_f]=function(){
_10=_10||this;
var _11=Y.Array(arguments),ret;
if(_11[0]&&_11[0] instanceof _7){
_11[0]=_11[0]._node;
}
if(_11[1]&&_11[1] instanceof _7){
_11[1]=_11[1]._node;
}
_11.unshift(this._node);
ret=_7.scrubVal(fn.apply(_10,_11),this);
return ret;
};
}else{
}
};
_7.importMethod=function(_12,_13,_14){
if(typeof _13==="string"){
_14=_14||_13;
_7.addMethod(_14,_12[_13],_12);
}else{
Y.each(_13,function(n){
_7.importMethod(_12,n);
});
}
};
_7.one=function(_15){
var _16=null,_17,uid;
if(_15){
if(typeof _15==="string"){
if(_15.indexOf("doc")===0){
_15=Y.config.doc;
}else{
if(_15.indexOf("win")===0){
_15=Y.config.win;
}else{
_15=Y.Selector.query(_15,null,true);
}
}
if(!_15){
return null;
}
}else{
if(_15 instanceof _7){
return _15;
}
}
uid=_15._yuid;
_16=_7._instances[uid];
_17=_16?_16._node:null;
if(!_16||(_17&&_15!==_17)){
_16=new _7(_15);
}
}
return _16;
};
_7.get=function(){
return _7.one.apply(_7,arguments);
};
_7.create=function(){
return _7.get(Y.DOM.create.apply(Y.DOM,arguments));
};
_7.ATTRS={text:{getter:function(){
return Y.DOM.getText(this._node);
},setter:function(_18){
Y.DOM.setText(this._node,_18);
return _18;
}},"options":{getter:function(){
return this._node.getElementsByTagName("option");
}},"elements":{getter:function(){
return Y.all(this._node.elements);
}},"children":{getter:function(){
var _19=this._node,_1a=_19.children,_1b,i,len;
if(!_1a){
_1b=_19.childNodes;
_1a=[];
for(i=0,len=_1b.length;i<len;++i){
if(_1b[i][_5]){
_1a[_1a.length]=_1b[i];
}
}
}
return Y.all(_1a);
}},value:{getter:function(){
return Y.DOM.getValue(this._node);
},setter:function(val){
Y.DOM.setValue(this._node,val);
return val;
}},data:{getter:function(){
return this._data;
},setter:function(val){
this._data=val;
return val;
}}};
_7.DEFAULT_SETTER=function(_1c,val){
var _1d=this._stateProxy,_1e;
if(_1c.indexOf(_1)>-1){
_1e=_1c;
_1c=_1c.split(_1);
Y.Object.setValue(_1d,_1c,val);
}else{
if(_1d[_1c]!==undefined){
_1d[_1c]=val;
}
}
return val;
};
_7.DEFAULT_GETTER=function(_1f){
var _20=this._stateProxy,val;
if(_1f.indexOf&&_1f.indexOf(_1)>-1){
val=Y.Object.getValue(_20,_1f.split(_1));
}else{
if(_20[_1f]!==undefined){
val=_20[_1f];
}
}
return val;
};
Y.augment(_7,Y.Event.Target);
Y.mix(_7.prototype,{toString:function(){
var str="",_21=this[_6]+": not bound to a node",_22=this._node;
if(_22){
str+=_22[_2];
if(_22.id){
str+="#"+_22.id;
}
if(_22.className){
str+="."+_22.className.replace(" ",".");
}
str+=" "+this[_6];
}
return str||_21;
},get:function(_23){
var val;
if(this._getAttr){
val=this._getAttr(_23);
}else{
val=this._get(_23);
}
if(val){
val=Y.Node.scrubVal(val,this);
}
return val;
},_get:function(_24){
var _25=_7.ATTRS[_24],val;
if(_25&&_25.getter){
val=_25.getter.call(this);
}else{
if(_7.re_aria.test(_24)){
val=this._node.getAttribute(_24,2);
}else{
val=_7.DEFAULT_GETTER.apply(this,arguments);
}
}
return val;
},set:function(_26,val){
var _27=_7.ATTRS[_26];
if(this._setAttr){
this._setAttr.apply(this,arguments);
}else{
if(_27&&_27.setter){
_27.setter.call(this,val);
}else{
if(_7.re_aria.test(_26)){
this._node.setAttribute(_26,val);
}else{
_7.DEFAULT_SETTER.apply(this,arguments);
}
}
}
return this;
},setAttrs:function(_28){
if(this._setAttrs){
this._setAttrs(_28);
}else{
Y.Object.each(_28,function(v,n){
this.set(n,v);
},this);
}
return this;
},getAttrs:function(_29){
var ret={};
if(this._getAttrs){
this._getAttrs(_29);
}else{
Y.Array.each(_29,function(v,n){
ret[v]=this.get(v);
},this);
}
return ret;
},create:_7.create,compareTo:function(_2a){
var _2b=this._node;
if(_2a instanceof Y.Node){
_2a=_2a._node;
}
return _2b===_2a;
},inDoc:function(doc){
var _2c=this._node;
doc=(doc)?doc._node||doc:_2c[_4];
if(doc.documentElement){
return Y.DOM.contains(doc.documentElement,_2c);
}
},getById:function(id){
var _2d=this._node,ret=Y.DOM.byId(id,_2d[_4]);
if(ret&&Y.DOM.contains(_2d,ret)){
ret=Y.one(ret);
}else{
ret=null;
}
return ret;
},ancestor:function(fn){
return _7.get(Y.DOM.elementByAxis(this._node,"parentNode",_a(fn)));
},previous:function(fn,all){
return _7.get(Y.DOM.elementByAxis(this._node,"previousSibling",_a(fn),all));
},next:function(_2e,fn,all){
return _7.get(Y.DOM.elementByAxis(this._node,"nextSibling",_a(fn),all));
},one:function(_2f){
return Y.one(Y.Selector.query(_2f,this._node,true));
},query:function(_30){
return this.one(_30);
},all:function(_31){
var _32=Y.all(Y.Selector.query(_31,this._node));
_32._query=_31;
return _32;
},queryAll:function(_33){
return this.all(_33);
},test:function(_34){
return Y.Selector.test(this._node,_34);
},remove:function(_35){
var _36=this._node;
_36.parentNode.removeChild(_36);
if(_35){
this.destroy(true);
}
return this;
},replace:function(_37){
var _38=this._node;
_38.parentNode.replaceChild(_37,_38);
return this;
},purge:function(_39,_3a){
Y.Event.purgeElement(this._node,_39,_3a);
},destroy:function(_3b){
delete _7._instances[this[_6]];
if(_3b){
this.purge(true);
}
if(this.unplug){
this.unplug();
}
this._node._yuid=null;
this._node=null;
this._stateProxy=null;
},invoke:function(_3c,a,b,c,d,e){
var _3d=this._node,ret;
if(a&&a instanceof Y.Node){
a=a._node;
}
if(b&&b instanceof Y.Node){
b=b._node;
}
ret=_3d[_3c](a,b,c,d,e);
return Y.Node.scrubVal(ret,this);
},each:function(fn,_3e){
_3e=_3e||this;
return fn.call(_3e,this);
},item:function(_3f){
return this;
},size:function(){
return this._node?1:0;
},insert:function(_40,_41){
var _42=this._node;
if(_40){
if(typeof _41==="number"){
_41=this._node.childNodes[_41];
}
if(typeof _40!=="string"){
if(_40._node){
_40=_40._node;
}else{
if(_40._nodes||(!_40.nodeType&&_40.length)){
Y.each(_40._nodes,function(n){
Y.DOM.addHTML(_42,n,_41);
});
return this;
}
}
}
Y.DOM.addHTML(_42,_40,_41);
}
return this;
},prepend:function(_43){
return this.insert(_43,0);
},append:function(_44){
return this.insert(_44,null);
},setContent:function(_45){
Y.DOM.addHTML(this._node,_45,"replace");
return this;
},hasMethod:function(_46){
var _47=this._node;
return (_47&&(typeof _47==="function"));
}},true);
Y.Node=_7;
Y.get=Y.Node.get;
Y.one=Y.Node.one;
var _48=function(_49){
if(typeof _49==="string"){
this._query=_49;
_49=Y.Selector.query(_49);
}else{
_49=Y.Array(_49,0,true);
}
_48._instances[Y.stamp(this)]=this;
this._nodes=_49;
};
_48.NAME="NodeList";
_48.getDOMNodes=function(_4a){
return _4a._nodes;
};
_48._instances=[];
_48.each=function(_4b,fn,_4c){
var _4d=_4b._nodes;
if(_4d&&_4d.length){
Y.Array.each(_4d,fn,_4c||_4b);
}else{
}
};
_48.addMethod=function(_4e,fn,_4f){
if(_4e&&fn){
_48.prototype[_4e]=function(){
var ret=[],_50=arguments;
Y.Array.each(this._nodes,function(_51){
var UID="_yuid",_52=Y.Node._instances[_51[UID]],ctx,_53;
if(!_52){
_52=_48._getTempNode(_51);
}
ctx=_4f||_52;
_53=fn.apply(ctx,_50);
if(_53!==undefined&&_53!==_52){
ret[ret.length]=_53;
}
});
return ret.length?ret:this;
};
}else{
}
};
_48.importMethod=function(_54,_55,_56){
if(typeof _55==="string"){
_56=_56||_55;
_48.addMethod(_55,_54[_55]);
}else{
Y.each(_55,function(n){
_48.importMethod(_54,n);
});
}
};
_48._getTempNode=function(_57){
var tmp=_48._tempNode;
if(!tmp){
tmp=Y.Node.create("<div></div>");
_48._tempNode=tmp;
}
tmp._node=_57;
tmp._stateProxy=_57;
return tmp;
};
Y.mix(_48.prototype,{item:function(_58){
return Y.one((this._nodes||[])[_58]);
},each:function(fn,_59){
var _5a=this;
Y.Array.each(this._nodes,function(_5b,_5c){
_5b=Y.one(_5b);
return fn.call(_59||_5b,_5b,_5c,_5a);
});
return _5a;
},batch:function(fn,_5d){
var _5e=this;
Y.Array.each(this._nodes,function(_5f,_60){
var _61=Y.Node._instances[_5f[_6]];
if(!_61){
_61=_48._getTempNode(_5f);
}
return fn.call(_5d||_61,_61,_60,_5e);
});
return _5e;
},some:function(fn,_62){
var _63=this;
return Y.Array.some(this._nodes,function(_64,_65){
_64=Y.one(_64);
_62=_62||_64;
return fn.call(_62,_64,_65,_63);
});
},toFrag:function(){
return Y.one(Y.DOM._nl2frag(this._nodes));
},indexOf:function(_66){
return Y.Array.indexOf(this._nodes,Y.Node.getDOMNode(_66));
},filter:function(_67){
return Y.all(Y.Selector.filter(this._nodes,_67));
},modulus:function(n,r){
r=r||0;
var _68=[];
_48.each(this,function(_69,i){
if(i%n===r){
_68.push(_69);
}
});
return Y.all(_68);
},odd:function(){
return this.modulus(2,1);
},even:function(){
return this.modulus(2);
},destructor:function(){
delete _48._instances[this[_6]];
},refresh:function(){
var doc,_6a=this._nodes;
if(this._query){
if(_6a&&_6a[0]&&_6a[0].ownerDocument){
doc=_6a[0].ownerDocument;
}
this._nodes=Y.Selector.query(this._query,doc||Y.config.doc);
}
return this;
},on:function(_6b,fn,_6c){
var _6d=Y.Array(arguments,0,true);
_6d.splice(2,0,this._nodes);
_6d[3]=_6c||this;
return Y.on.apply(Y,_6d);
},after:function(_6e,fn,_6f){
var _70=Y.Array(arguments,0,true);
_70.splice(2,0,this._nodes);
_70[3]=_6f||this;
return Y.after.apply(Y,_70);
},size:function(){
return this._nodes.length;
},toString:function(){
var str="",_71=this[_6]+": not bound to any nodes",_72=this._nodes,_73;
if(_72&&_72[0]){
_73=_72[0];
str+=_73[_2];
if(_73.id){
str+="#"+_73.id;
}
if(_73.className){
str+="."+_73.className.replace(" ",".");
}
if(_72.length>1){
str+="...["+_72.length+" items]";
}
}
return str||_71;
}},true);
_48.importMethod(Y.Node.prototype,["append","detach","detachAll","insert","prepend","remove","set","setContent"]);
_48.prototype.get=function(_74){
var ret=[],_75=this._nodes,_76=false,_77=_48._getTempNode,_78,val;
if(_75[0]){
_78=Y.Node._instances[_75[0]._yuid]||_77(_75[0]);
val=_78._get(_74);
if(val&&val.nodeType){
_76=true;
}
}
Y.Array.each(_75,function(_79){
_78=Y.Node._instances[_79._yuid];
if(!_78){
_78=_77(_79);
}
val=_78._get(_74);
if(!_76){
val=Y.Node.scrubVal(val,_78);
}
ret.push(val);
});
return (_76)?Y.all(ret):ret;
};
Y.NodeList=_48;
Y.all=function(_7a){
return new _48(_7a);
};
Y.Node.all=Y.all;
Y.Array.each(["replaceChild","appendChild","insertBefore","removeChild","hasChildNodes","cloneNode","hasAttribute","removeAttribute","scrollIntoView","getElementsByTagName","focus","blur","submit","reset","select"],function(_7b){
Y.Node.prototype[_7b]=function(_7c,_7d,_7e){
var ret=this.invoke(_7b,_7c,_7d,_7e);
return ret;
};
});
_7.importMethod(Y.DOM,["contains","setAttribute","getAttribute"]);
Y.NodeList.importMethod(Y.Node.prototype,["getAttribute","setAttribute"]);
(function(Y){
var _7f=["hasClass","addClass","removeClass","replaceClass","toggleClass"];
Y.Node.importMethod(Y.DOM,_7f);
Y.NodeList.importMethod(Y.Node.prototype,_7f);
})(Y);
if(!document.documentElement.hasAttribute){
Y.Node.prototype.hasAttribute=function(_80){
return Y.DOM.getAttribute(this._node,_80)!=="";
};
}
Y.Node.ATTRS.type={setter:function(val){
if(val==="hidden"){
try{
this._node.type="hidden";
}
catch(e ){
this.setStyle("display","none");
this._inputType="hidden";
}
}else{
try{
this._node.type=val;
}
catch(e ){
}
}
return val;
},getter:function(){
return this._inputType||this._node.type;
},_bypassProxy:true};
},"3.0.0",{requires:["dom-base","selector-css2","event-base"]});

