selector-css2-min.js revision 421ddfc10d9571fe072551fd09da1044bb90570c
YUI.add("selector-css2",function(c){var h="parentNode",g="tagName",e="attributes",f="combinator",d="pseudos",a=c.Selector,b=(function(){var j=(c.config.doc.createElement("div").tagName!=="DIV");return j;})(),i={_reRegExpTokens:/([\^\$\?\[\]\*\+\-\.\(\)\|\\])/,SORT_RESULTS:true,_children:function(n,j){var l=0,k=n.children,o,m,p;if(k&&k.tags){if(j){k=n.children.tags(j);}else{m=k.tags("!").length;}}if(!k||(!k.tag&&j)||m){o=k||n.childNodes;k=[];while((p=o[l++])){if(p.nodeType===1){if(!j||j===p.tagName){k.push(p);}}}}return k||[];},_re:{attr:/(\[[^\]]*\])/g,esc:/\\[:\[\]\(\)#\.\'\>+~"]/gi,pseudos:/(\([^\)]*\))/g},shorthand:{"\\#(-?[_a-z0-9]+[-\\w\\uE000]*)":"[id=$1]","\\.(-?[_a-z]+[-\\w\\uE000]*)":"[className~=$1]"},operators:{"":function(k,j){return c.DOM.getAttribute(k,j)!=="";},"~=":"(?:^|\\s+){val}(?:\\s+|$)","|=":"^{val}-?"},pseudos:{"first-child":function(j){return c.Selector._children(j[h])[0]===j;}},_bruteQuery:function(o,s,u){var p=[],j=[],r=a._tokenize(o),n=r[r.length-1],t=c.DOM._getDoc(s),l,k,q,m;if(n){k=n.id;q=n.className;m=n.tagName||"*";if(s.getElementsByTagName){if(k&&(s.all||(s.nodeType===9||c.DOM.inDoc(s)))){j=c.DOM.allById(k,s);}else{if(q){j=s.getElementsByClassName(q);}else{j=s.getElementsByTagName(m);}}}else{l=s.firstChild;while(l){if(l.tagName){j.push(l);}l=l.nextSilbing||l.firstChild;}}if(j.length){p=a._filterNodes(j,r,u);}}return p;},_filterNodes:function(u,q,s){var z=0,y,A=q.length,t=A-1,p=[],w=u[0],D=w,B=c.Selector.getters,o,x,m,r,k,v,l,C;for(z=0;(D=w=u[z++]);){t=A-1;r=null;testLoop:while(D&&D.tagName){m=q[t];l=m.tests;y=l.length;if(y&&!k){while((C=l[--y])){o=C[1];if(B[C[0]]){v=B[C[0]](D,C[0]);}else{v=D[C[0]];if(v===undefined&&D.getAttribute){v=D.getAttribute(C[0]);}}if((o==="="&&v!==C[2])||(typeof o!=="string"&&o.test&&!o.test(v))||(!o.test&&typeof o==="function"&&!o(D,C[0],C[2]))){if((D=D[r])){while(D&&(!D.tagName||(m.tagName&&m.tagName!==D.tagName))){D=D[r];}}continue testLoop;}}}t--;if(!k&&(x=m.combinator)){r=x.axis;D=D[r];while(D&&!D.tagName){D=D[r];}if(x.direct){r=null;}}else{p.push(w);if(s){return p;}break;}}}w=D=null;return p;},combinators:{" ":{axis:"parentNode"},">":{axis:"parentNode",direct:true},"+":{axis:"previousSibling",direct:true}},_parsers:[{name:e,re:/^\uE003(-?[a-z]+[\w\-]*)+([~\|\^\$\*!=]=?)?['"]?([^\uE004'"]*)['"]?\uE004/i,fn:function(m,n){var l=m[2]||"",j=a.operators,k=(m[3])?m[3].replace(/\\/g,""):"",o;if((m[1]==="id"&&l==="=")||(m[1]==="className"&&c.config.doc.documentElement.getElementsByClassName&&(l==="~="||l==="="))){n.prefilter=m[1];m[3]=k;n[m[1]]=(m[1]==="id")?m[3]:k;}if(l in j){o=j[l];if(typeof o==="string"){m[3]=k.replace(a._reRegExpTokens,"\\$1");o=new RegExp(o.replace("{val}",m[3]));}m[2]=o;}if(!n.last||n.prefilter!==m[1]){return m.slice(1);}}},{name:g,re:/^((?:-?[_a-z]+[\w-]*)|\*)/i,fn:function(k,l){var j=k[1];if(!b){j=j.toUpperCase();}l.tagName=j;if(j!=="*"&&(!l.last||l.prefilter)){return[g,"=",j];}if(!l.prefilter){l.prefilter="tagName";}}},{name:f,re:/^\s*([>+~]|\s)\s*/,fn:function(j,k){}},{name:d,re:/^:([\-\w]+)(?:\uE005['"]?([^\uE005]*)['"]?\uE006)*/i,fn:function(j,k){var l=a[d][j[1]];if(l){if(j[2]){j[2]=j[2].replace(/\\/g,"");}return[j[2],l];}else{return false;}}}],_getToken:function(j){return{tagName:null,id:null,className:null,attributes:{},combinator:null,tests:[]};},_tokenize:function(l){l=l||"";l=a._replaceShorthand(c.Lang.trim(l));var k=a._getToken(),q=l,p=[],r=false,n,o,m,j;outer:do{r=false;for(m=0;(j=a._parsers[m++]);){if((n=j.re.exec(l))){if(j.name!==f){k.selector=l;}l=l.replace(n[0],"");if(!l.length){k.last=true;}if(a._attrFilters[n[1]]){n[1]=a._attrFilters[n[1]];}o=j.fn(n,k);if(o===false){r=false;break outer;}else{if(o){k.tests.push(o);}}if(!l.length||j.name===f){p.push(k);k=a._getToken(k);if(j.name===f){k.combinator=c.Selector.combinators[n[1]];}}r=true;}}}while(r&&l.length);if(!r||l.length){p=[];}return p;},_replaceShorthand:function(k){var m=a.shorthand,l=k.match(a._re.esc),n,q,p,o,j;if(l){k=k.replace(a._re.esc,"\uE000");}n=k.match(a._re.attr);q=k.match(a._re.pseudos);if(n){k=k.replace(a._re.attr,"\uE001");}if(q){k=k.replace(a._re.pseudos,"\uE002");}for(p in m){if(m.hasOwnProperty(p)){k=k.replace(new RegExp(p,"gi"),m[p]);}}if(n){for(o=0,j=n.length;o<j;++o){k=k.replace(/\uE001/,n[o]);}}if(q){for(o=0,j=q.length;o<j;++o){k=k.replace(/\uE002/,q[o]);}}k=k.replace(/\[/g,"\uE003");k=k.replace(/\]/g,"\uE004");k=k.replace(/\(/g,"\uE005");k=k.replace(/\)/g,"\uE006");if(l){for(o=0,j=l.length;o<j;++o){k=k.replace("\uE000",l[o]);}}return k;},_attrFilters:{"class":"className","for":"htmlFor"},getters:{href:function(k,j){return c.DOM.getAttribute(k,j);}}};c.mix(c.Selector,i,true);c.Selector.getters.src=c.Selector.getters.rel=c.Selector.getters.href;if(c.Selector.useNative&&c.config.doc.querySelector){c.Selector.shorthand["\\.(-?[_a-z]+[-\\w]*)"]="[class~=$1]";}},"@VERSION@",{requires:["selector-native"]});