-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqsa.min.htc
More file actions
41 lines (41 loc) · 11 KB
/
qsa.min.htc
File metadata and controls
41 lines (41 loc) · 11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<PUBLIC:COMPONENT lightWeight="true">
<script type="text/javascript">
/*
* QSA CSS3 Selector Engine v1.3
*
* Copyright 2011, Dmitriy Pakhtinov ( spb.piksel@gmail.com )
*
* http://spb-piksel.ru/
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Update: 06-05-2012
*/
var ie=eval("/*@cc_on @_jscript_version;@*/"),doc=element.document,win=doc.parentWindow;
if(!win.qsa)if(function(j,B){var r=/\s*(?:(\*|(?:(?:\*|[\w\-]+)\|)?(?:[\w\-]+|\*)))?(?:\[\s*(?:((?:[\w\-]+\|)?[\w\-]+)\s*((?:~|\^|\$|\*|\||!)?=)\s*)?((?:".*?(?:(?:[\\]{2}(?="))|[^\\])"|'.*?(?:(?:[\\]{2}(?='))|[^\\])'|[^\]].*?)?)\s*\])?(?:(\.|#)([\w\-]+))?(?:(:(?::)?)([\w\-]+)(?:\(\s*([^)]+)\s*\))?)?(?:(?:\s*(?=\s))?(?:(?:\s(?=,|>|\+|~))?([\s,>+~](?!$)))?)?/g,G=!0,x=!1,y=j.document,o=y.documentElement,E=Array.prototype.slice,H=Array.prototype.splice,F=Array.prototype.push,v=y.createElement("div"),
C=o.matchesSelector||o.oMatchesSelector||o.mozMatchesSelector||o.webkitMatchesSelector||o.msMatchesSelector,J=C&&!C.call(v,"div"),I;v.innerHTML="<p class='TEST'></p>";I=!(!v.querySelectorAll||0===v.querySelectorAll(".TEST").length);var g={moveElems:function(){var b=!0;v.innerHTML="";v.appendChild(y.createComment(""));try{E.call(o.childNodes,0)}catch(d){b=!1}return 0<v.getElementsByTagName("*").length||!b?function(a,d,g,c,h){if(!g&&!c&&b)F.apply(d,E.call(a,0));else if(!g&&!c&&h)F.apply(d,a);else{c=
0;for(h=d.length;a[c];c++)if(1===a[c].nodeType&&(!g||g===a[c]))d[h++]=a[c];h===d.length||(d.length=h)}return d}:function(a,b,d){if(d){for(var c=0,h=b.length;a[c];c++)1===a[c].nodeType&&d===a[c]&&(b[h++]=a[c]);h===b.length||(b.length=h)}else F.apply(b,E.call(a,0));return b}}(),sortElems:function(){[0,0].sort(function(){G=!1;return 0});return o.compareDocumentPosition?function(b,d){if(b==d)return x=!0,0;if(o.compareDocumentPosition)return!b.compareDocumentPosition||!d.compareDocumentPosition?b.compareDocumentPosition?
-1:1:b.compareDocumentPosition(d)&4?-1:b===d?0:1}:"sourceIndex"in o?function(b,d){return b==d?(x=!0,0):!b.sourceIndex||!d.sourceIndex?b.sourceIndex?-1:1:b.sourceIndex-d.sourceIndex}:y.createRange?function(b,d){if(b==d)return x=!0,0;if(!b.ownerDocument||!d.ownerDocument)return b.ownerDocument?-1:1;var a=b.ownerDocument.createRange(),p=d.ownerDocument.createRange();a.setStart(b,0);a.setEnd(b,0);p.setStart(d,0);p.setEnd(d,0);return a.compareBoundaryPoints(Range.START_TO_END,p)}:function(b,d){b==d&&(x=
!0);return 0}}(),attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(b){return b.getAttribute("href",2)},type:function(b){return b.getAttribute("type")},style:function(b){var d=b.getAttribute("style");return"object"===typeof d?b.style.cssText||"":d}},checkAttr:function(b,d,a){var a=g.attrHandle[a]?g.attrHandle[a](d):null!=d[a]?d[a]:d.getAttribute(a),d=b[3],b=b[4],p=a+"";return null==a?"!="===d:"="===d?p===b:"*="===d?0<=p.indexOf(b):"~="===d?0<=(" "+p+" ").indexOf(" "+b+" "):!b?
p&&!1!==a:"!="===d?p!==b:"^="===d?0===p.indexOf(b):"$="===d?p.substr(p.length-b.length)===b:"|="===d?p===b||p.substr(0,b.length+1)===b+"-":!1},filters:function(){function b(a,b,d){a=d-b[1];return 0===b[0]?0===a:0===a%b[0]&&0<=a/b[0]}var d={":":{"nth-child":function(a,d){return b(a,d,a.nodeIndex||1)},"nth-last-child":function(a,d){var g=a.parentNode;return b(a,d,(g&&(g._qsaCE||g.children.length||0)+1||2)-(a.nodeIndex||1))},"first-child":function(a){a=a.previousSibling;return!(a&&(3===a.nodeType?a.previousSibling:
1))},"last-child":function(a){a=a.nextSibling;return!(a&&(3===a.nodeType?a.nextSibling:1))},empty:function(a){return!a.firstChild},enabled:function(a){return!1===a.disabled&&"hidden"!==a.type},disabled:function(a){return!0===a.disabled},checked:function(a){return!0===a.checked},not:function(a,b,d,c){return(!c[1]||c[1]&&a.nodeName===c[1])&&0<g.checkRule(c,[a],[]).length?!1:!0},contains:function(a,b){return 0<=(a.textContent||a.innerText||a.nodeValue||a.value||"").indexOf(b)}},"::":{}};d[":"]["only-child"]=
function(a){return d[":"]["first-child"](a)&&d[":"]["last-child"](a)};return d}(),preFilters:function(){var b={"nth-child":function(b){var a=b[9].replace(/^\+|\s*/g,""),a=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec("even"===a&&"2n"||"odd"===a&&"2n+1"||!/\D/.test(a)&&"0n+"+a||a);b[9]=[a[1]+(a[2]||1)-0,a[3]-0];return!(1===b[9][0]&&0===b[9][1])}};b["nth-last-child"]=b["nth-child"];return b}(),checkRule:function(b,d,a,p,j){var c,h,D=d.length,k,n,i=!1,s,q,e,f=0,w,l;!b[2]&&b[4]?(b[2]=b[4],b[4]=B):b[4]&&(b[4]=b[4].replace(/^(?:"(.*)"|'(.*)')$/,
"$1$2").replace(/\\/g,""));k=g.attrMap[b[2]]||b[2];s="."===b[5]?1:"#"===b[5]?2:!1;n=b[6];q=g.filters[b[7]]&&g.filters[b[7]][b[8]]||b[8]&&g.error(b[8])||!1;if(!k&&!s&&!q&&D)g.moveElems(d,a,j,!p,d instanceof Array);else{q&&b[9]&&(r.lastIndex=0,e=r.exec(b[9]),e[1]=e[1]&&"*"!==e[1]?e[1].replace("|",":").toUpperCase():B,g.preFilters[b[8]]&&(i=g.preFilters[b[8]](b)));c=a.length;for(p=0;p<D;p++)if(h=d[p],1===h.nodeType){k&&!g.checkAttr(b,h,k)&&(h=null);if(h&&s)if(1===s){if(!h.className||!(0<=(" "+h.className+
" ").indexOf(" "+n+" ")))h=null}else 2===s&&h.id!==n&&(h=null);if(h&&q){if(i&&(w=h.parentNode)&&(!h.nodeIndex||w._qsaCL!==w.children.length)){f=0;for(l=w.firstChild;l;l=l.nextSibling)1===l.nodeType&&(l.nodeIndex=++f);w._qsaCE=f;w._qsaCL=w.children.length}q(h,b[9],b,e)||(h=null)}j&&j!==h&&(h=null);h&&(a[c++]=h)}c===a.length||(a.length=c)}return a},parser:function(b,d,a,p,j){var c,h,D,k,n,i,s,q=b.length,e,f,w=!0,l,m=[],o=[],v,x,A=a[0],C=r.lastIndex,t,z,u;h=0;for(D=d.length;h<D;h++){x=d[h];u=C;do{r.lastIndex=
u;c=r.exec(b);(v=!c[4]&&!c[5]&&!c[7])&&!c[1]&&g.error(b.substring(u));u=r.lastIndex;t=c[1]&&"*"!==c[1]?c[1].replace("|",":"):B;l=c[10];if(v&&!0===w&&("~"===l||">"===l))o.push({tag:t?t.toUpperCase():t,rule:l}),l=!0,e=[];else if(">"===w){e=[];z=t?t.toUpperCase():t;for(k=0;f=m[k];k++){f=f.children;for(i=0;n=f[i];i++)1===n.nodeType&&(z?z===n.nodeName&&(e[e.length]=n):e[e.length]=n)}a[1]=!0}else if("+"===w||"~"===w){e=[];k=0;for(n=m.length;k<n;k++){z=t?t.toUpperCase():t;for(f=m[k];(f=f.nextSibling)&&!(1===
f.nodeType&&(z?z===f.nodeName&&(e[e.length]=f):e[e.length]=f,"+"===w)););}a[1]=!0}else if("#"===c[5]&&!(s=!1)||"id"===c[2]&&"="===c[3]&&(s=!0)){s&&(c[6]=c[4].replace(/^(?:"(.*)"|'(.*)')$/,"$1$2").replace(/\\/g,""),c[2]=c[3]=c[4]=B);e=[];i=c[6];if(x===y){m=[];z=t?t.toUpperCase():t;do if(n=y.getElementById(i))m[m.length]=n,n.setAttribute("id",i+" _");while(n);for(s=0;f=m[s];s++)if(f.setAttribute("id",i),!z||f.nodeName===z)e[e.length]=f}else{m=x.getElementsByTagName(t||"*");for(s=0;f=m[s];s++)f.id&&
f.id===i&&(e[e.length]=f)}c[5]=B}else"."===c[5]&&!t&&x.getElementsByClassName?(e=x.getElementsByClassName(c[6]),v=!c[4]&&!c[7]&&(","===l||u===q),c[5]=B):e=x.getElementsByTagName(t||"*");if(v)m=e,0==o.length&&e.length&&(","===l||u===q)&&g.moveElems(e,A,j,!t,e instanceof Array);else if(m=0<e.length?0==o.length&&(","===l||u===q)?g.checkRule(c,e,A,t,j):g.checkRule(c,e,[],t):[],!l&&u<q){n=m.length;do if(r.lastIndex=u,c=r.exec(b),u=r.lastIndex,l=c[10],n&&(m=0==o.length&&(","===l||u===q)?g.checkRule(c,m,
A,t,j):g.checkRule(c,m,[],t),n=m.length),l)break;while(u<q)}if(!0!==l&&0<o.length)if(0===m.length)o.length=0;else{e=[];for(i=0;f=m[i];)e[i++]=f;for(k=A.length;c=o.pop();)if(n=o.length,">"===c.rule)for(i=0;f=e[i];i++)f.parentNode&&(!c.tag||f.parentNode.nodeName===c.tag)?0===n?","===l||u===q?A[k++]=m[i]:e[i]=m[i]:e[i]=f.parentNode:e[i]=!0;else for(i=0;f=e[i];i++){f=f.previousSibling;for(s=!1;f;){if(1===f.nodeType&&(!c.tag||f.nodeName===c.tag)){0===n?","===l||u===q?A[k++]=m[i]:e[i]=m[i]:e[i]=f;s=!0;
break}f=f.previousSibling}s||(e[i]=!0)}k===A.length||(A.length=k);if(!(","===l||u===q)){m=[];for(i=0;f=e[i];i++)!0!==f&&m.push(f)}}if(" "===l)if(0<m.length)r.lastIndex=u,a=g.parser(b,m,a,!0,j),u=r.lastIndex,a[1]=!0;else{r.lastIndex=u;do if(c=r.exec(b),!c[4]&&!c[5]&&!c[7]&&!c[1]&&g.error(b.substring(u)),","===c[10])break;while(r.lastIndex<q);u=r.lastIndex;l=c[10]}if(","===l&&(a[1]=!0,p))break;w=l}while(u<q)}return a},querySelectorAll:function(b,d,a,j,o){a=a||[];a.length=a.length||0;d=d&&(d.nodeType?
[d]:d)||[y];r.lastIndex=0;var c,h,v,k,n=!0,i=a instanceof Array;if(I){var s,q,e,f=/^\s*[>+~]/.test(b),w=g.originalQSA||y.querySelectorAll;v=[a,0<a.length||1<d.length];c=0;for(h=d.length;c<h;c++)if(k=d[c],9===k.nodeType)try{g.moveElems(w.call(k,b),v[0],o),n=!1}catch(l){break}else if(1===k.nodeType&&"OBJECT"!==k.nodeName)if(f&&(s=k.parentNode)){e=(q=k.getAttribute("id"))&&q.replace(/'/g,"\\$&")||"__qsaEngine__";!q&&k.setAttribute("id",e);try{g.moveElems(w.call(s,"[id='"+e+"'] "+b),v[0],o),n=!1}catch(m){break}!q&&
k.removeAttribute("id")}else if(f)break;else try{g.moveElems(w.call(k,b),v[0],o),n=!1}catch(B){break}}n&&(v=g.parser(b,d,[a,0<a.length||1<d.length],0,o));if(v[1]&&1<a.length)if(j){for(c=a.length;c--;)a[c]._hasDuplicate?(H.call(a,c,1),i||delete a[a.length]):a[c]._hasDuplicate=!0;for(c=a.length;c--;)a[c]._hasDuplicate=null}else if(x=G,Array.prototype.sort.call(a,g.sortElems),x)for(c=1;c<a.length;c++)a[c]===a[c-1]&&(H.call(a,c--,1),i||delete a[a.length]);return a},matchesSelector:function(b,d){if(C){var a=
C.call(b,d);if(a||!J||b.document&&11!==b.document.nodeType)return a}return 0<g.querySelectorAll(d,null,null,!0,b).length},error:function(b){throw Error("Syntax error: "+b);}};j.correctQSA=function(b,d){if(d===y)return g.querySelectorAll(b,d);var a;r.lastIndex=0;do if(a=r.exec(b),!a[10]||" "===a[10])if((!a[1]||a[1]&&d.nodeName===a[1].toUpperCase())&&0<g.checkRule(a,[d],[]).length){if(" "===a[10]){b=b.substr(r.lastIndex,b.length-r.lastIndex);break}}else break;else break;while(r.lastIndex<b.length);
return g.querySelectorAll(b,d)};j.qsa=g}(win),qsa.originalQSA=doc.querySelectorAll,doc.querySelectorAll=function(j){return win.correctQSA(j,this)},doc.querySelector=function(j){return win.correctQSA(j,this)[0]||null},doc.documentElement.matchesSelector=function(j){return qsa.matchesSelector(this,j)},doc.querySelectorAll.toString=function(){return"function querySelectorAll() {\n [native code]\n}"},doc.querySelector.toString=function(){return"function querySelector() {\n [native code]\n}"},doc.documentElement.matchesSelector.toString=
function(){return"function matchesSelector() {\n [native code]\n}"},5.8>ie){var __createElement=doc.createElement,__createDocumentFragment=doc.createDocumentFragment,copyMethod=function(j){j&&!j.querySelectorAll&&(j.querySelectorAll=doc.querySelectorAll,j.querySelector=doc.querySelector,j.matchesSelector=doc.documentElement.matchesSelector);return j};doc.createElement=function(j){return copyMethod(__createElement(j))};doc.createDocumentFragment=function(){return copyMethod(__createDocumentFragment())}}else{var ie8setMethods=
function(){win.Element.prototype.querySelectorAll=doc.querySelectorAll;win.Element.prototype.querySelector=doc.querySelector;win.Element.prototype.matchesSelector=doc.documentElement.matchesSelector};doc.attachEvent("onreadystatechange",function(){"complete"===doc.readyState&&(doc.detachEvent("onreadystatechange",arguments.callee),ie8setMethods())});win.attachEvent("onload",ie8setMethods)}
5.8>ie&&(element.querySelectorAll=doc.querySelectorAll,element.querySelector=doc.querySelector,element.matchesSelector=doc.documentElement.matchesSelector);
</script>
</PUBLIC:COMPONENT>