selector-css2-min.js revision 0fa21f434cf7d4ed63d790f8fb2a9c68e656d00e
YUI.add("selector-css2",function(C){var N="parentNode",M="tagName",I="attributes",J="combinator",G="pseudos",K="previous",L="previousSibling",E="yui-tmp-",F=0,B=[],H={},D=[],A=C.Selector,O={SORT_RESULTS:true,_children:function(T,P){var Q=T.children||T._children,S,R=[],U,V;if((!Q&&T[M])||(Q&&P)){U=Q||T.childNodes;Q=[];for(S=0,V;V=U[S++];){if(V.tagName){if(!P||P===V.tagName){Q.push(V);}if(!T.children){R.push(V);}}}if(!T.children&&!T._children){T._children=R;D.push(T);}}return Q||[];},_regexCache:{},_re:{attr:/(\[.*\])/g,pseudos:/:([\-\w]+(?:\(?:['"]?(.+)['"]?\)))*/i,urls:/^(?:href|src)/},shorthand:{"\\#(-?[_a-z]+[-\\w]*)":"[id=$1]","\\.(-?[_a-z]+[-\\w]*)":"[className~=$1]"},operators:{"":function(Q,P){return C.DOM.getAttribute(Q,P)!=="";},"~=":"(?:^|\\s+){val}(?:\\s+|$)","|=":"^{val}-?"},pseudos:{"first-child":function(P){return C.Selector._children(P[N])[0]===P;}},query:function(P,Q,S){var R=[];if(A.useNative&&A._supportsNative()&&!A._reUnSupported.test(P)){return A._nativeQuery.apply(A,arguments);}if(P){R=A._query.apply(A,arguments);}A._cleanup();return(S)?(R[0]||null):R;},_cleanup:function(){for(var P=0,Q;Q=D[P++];){delete Q._children;}D=[];},_query:function(V,b,d,T){var Y=[],S=V.split(","),P=[],c,a,U,Q,Z,R,W,X;if(S.length>1){for(W=0,X=S.length;W<X;++W){Y=Y.concat(arguments.callee(S[W],b,d,true));}Y=A._deDupe(Y);Y=A.SORT_RESULTS?A._sort(Y):Y;}else{b=b||C.config.doc;a=A._tokenize(V);if(b.tagName){if(!b.id){b.id=C.guid();}V="#"+b.id+" "+V;c=b.ownerDocument;a=A._tokenize(V);}else{c=b;}if(a[0]&&c===b&&(Q=a[0].id)&&c.getElementById(Q)){b=c.getElementById(Q);}U=a[a.length-1];if(U){Q=U.id;Z=U.className;R=U.tagName||"*";if(Q){if(c.getElementById(Q)){P=[c.getElementById(Q)];}}else{if(Z){P=b.getElementsByClassName(Z);}else{if(R){P=b.getElementsByTagName(R||"*");}}}if(P.length){Y=A._filterNodes(P,a,d);}}}return Y;},_filterNodes:function(Z,V,X){var e=0,d,f=V.length,Y=f-1,U=[],b=Z[0],k=b,g=C.Selector.getters,T,c,S,W,P,R="function",a,Q,h;for(e=0;k=b=Z[e++];){Y=f-1;W=null;testLoop:while(k&&k.tagName){S=V[Y];Q=S.tests;d=Q.length;if(d&&!P){while((h=Q[--d])){T=h[1];a=k[h[0]];if(g[h[0]]){a=g[h[0]](k,h[0]);}if((T==="="&&a!==h[2])||(T.test&&!T.test(a))||(T.call&&!T(k,h[0]))){if((k=k[W])){while(k&&(!k.tagName||(S.tagName&&S.tagName!==k.tagName))){k=k[W];}}continue testLoop;}}}Y--;if(!P&&(c=S.combinator)){W=c.axis;k=k[W];while(k&&!k.tagName){k=k[W];}if(c.direct){W=null;}}else{U.push(b);if(X){return U;}break;}}}b=k=null;return U;},_getRegExp:function(R,P){var Q=A._regexCache;P=P||"";if(!Q[R+P]){Q[R+P]=new RegExp(R,P);}return Q[R+P];},combinators:{" ":{axis:"parentNode"},">":{axis:"parentNode",direct:true},"+":{axis:"previousSibling",direct:true}},_parsers:[{name:I,re:/^\[([a-z]+\w*)+([~\|\^\$\*!=]=?)?['"]?([^\]]*?)['"]?\]/i,fn:function(R,S){var Q=R[2]||"",P=C.Selector.operators,T;if((R[1]==="id"&&Q==="=")||(R[1]==="className"&&document.getElementsByClassName&&(Q==="~="||Q==="="))){S.prefilter=R[1];S[R[1]]=R[3];}if(Q in P){T=P[Q];if(typeof T==="string"){T=C.Selector._getRegExp(T.replace("{val}",R[3]));}R[2]=T;}if(!S.last||S.prefilter!==R[1]){return R.slice(1);}}},{name:M,re:/^((?:-?[_a-z]+[\w-]*)|\*)/i,fn:function(Q,R){var P=Q[1].toUpperCase();R.tagName=P;if(P!=="*"&&(!R.last||R.prefilter)){return[M,"=",P];}if(!R.prefilter){R.prefilter="tagName";}}},{name:J,re:/^\s*([>+~]|\s)\s*/,fn:function(P,Q){}},{name:G,re:/^:([\-\w]+)(?:\(['"]?(.+)['"]?\))*/i,fn:function(P,Q){var R=A[G][P[1]];if(R){return[P[2],R];}}}],_getToken:function(P){return{tagName:null,id:null,className:null,attributes:{},combinator:null,tests:[]};},_tokenize:function(R){R=R||"";R=A._replaceShorthand(C.Lang.trim(R));var Q=A._getToken(),W=R,V=[],X=false,T,U,S,P;outer:do{X=false;for(S=0,P;P=A._parsers[S++];){if((T=P.re.exec(R))){if(P!==J){Q.selector=R;}R=R.replace(T[0],"");if(!R.length){Q.last=true;}if(A._attrFilters[T[1]]){T[1]=A._attrFilters[T[1]];}U=P.fn(T,Q);if(U){Q.tests.push(U);}if(!R.length||P.name===J){V.push(Q);Q=A._getToken(Q);if(P.name===J){Q.combinator=C.Selector.combinators[T[1]];}}X=true;}}}while(X&&R.length);if(!X||R.length){V=[];}return V;},_replaceShorthand:function(Q){var R=A.shorthand,S=Q.match(A._re.attr),V=Q.match(A._re.pseudos),U,T,P;if(V){Q=Q.replace(A._re.pseudos,"REPLACED_PSEUDO");}if(S){Q=Q.replace(A._re.attr,"REPLACED_ATTRIBUTE");}for(U in R){if(R.hasOwnProperty(U)){Q=Q.replace(A._getRegExp(U,"gi"),R[U]);}}if(S){for(T=0,P=S.length;T<P;++T){Q=Q.replace("REPLACED_ATTRIBUTE",S[T]);}}if(V){for(T=0,P=V.length;T<P;++T){Q=Q.replace("REPLACED_PSEUDO",V[T]);}}return Q;},_attrFilters:{"class":"className","for":"htmlFor"},getters:{href:function(Q,P){return C.DOM.getAttribute(Q,P);}}};C.mix(C.Selector,O,true);C.Selector.getters.src=C.Selector.getters.rel=C.Selector.getters.href;},"@VERSION@",{requires:["selector-native"],skinnable:false});