/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0b1
build: 1163
*/
YUI.add("selector-native",function(A){(function(C){C.namespace("Selector");var B={_reLead:/^\s*([>+~]|:self)/,_reUnSupported:/!./,_foundCache:[],_supportsNative:function(){return((C.UA.ie>=8||C.UA.webkit>525)&&document.querySelectorAll);},_toArray:function(E){var F=E,G,D;if(!E.slice){try{F=Array.prototype.slice.call(E);}catch(H){F=[];for(G=0,D=E.length;G<D;++G){F[G]=E[G];}}}return F;},_clearFoundCache:function(){var G=B._foundCache,E,D;for(E=0,D=G.length;E<D;++E){try{delete G[E]._found;}catch(F){G[E].removeAttribute("_found");}}G=[];},_sort:function(D){if(D){D=B._toArray(D);if(D.sort){D.sort(function(F,E){return C.DOM.srcIndex(F)-C.DOM.srcIndex(E);});}}return D;},_deDupe:function(E){var F=[],D=B._foundCache,G,H;for(G=0,H;H=E[G++];){if(!H._found){F[F.length]=D[D.length]=H;H._found=true;}}B._clearFoundCache();return F;},_prepQuery:function(G,F){var E=F.split(","),H=[],J=(G&&G.nodeType===9),I,D;if(G){if(!J){G.id=G.id||C.guid();for(I=0,D=E.length;I<D;++I){F="#"+G.id+" "+E[I];H.push({root:G.ownerDocument,selector:F});}}else{H.push({root:G,selector:F});}}return H;},_query:function(D,K,L){if(B._reUnSupported.test(D)){return C.Selector._brute.query(D,K,L);}var H=L?null:[],I=L?"querySelector":"querySelectorAll",M,F,E,J;K=K||C.config.doc;if(D){F=B._prepQuery(K,D);H=[];for(E=0,J;J=F[E++];){try{M=J.root[I](J.selector);if(I==="querySelectorAll"){M=B._toArray(M);}H=H.concat(M);}catch(G){}}if(F.length>1){H=B._sort(B._deDupe(H));}H=(!L)?H:H[0]||null;}return H;},_filter:function(E,D){var F=[],G,H;if(E&&D){for(G=0,H;(H=E[G++]);){if(C.Selector._test(H,D)){F[F.length]=H;}}}else{}return F;},_test:function(I,E){var F=false,D=E.split(","),H,G,J;if(I&&I.tagName){I.id=I.id||C.guid();for(G=0,J;J=D[G++];){J+="#"+I.id;H=C.Selector.query(J,null,true);F=(H===I);if(F){break;}}}return F;}};if(C.UA.ie&&C.UA.ie<=8){B._reUnSupported=/:(?:nth|not|root|only|checked|first|last|empty)/;}C.mix(C.Selector,B,true);if(B._supportsNative()){C.Selector.query=B._query;}C.Selector.test=B._test;C.Selector.filter=B._filter;})(A);},"3.0.0b1",{requires:["dom-base"],skinnable:false});