]> git.wh0rd.org - tt-rss.git/blame - lib/dojo/_base/query-sizzle.js
mobile: allow showing category content inline (closes #315)
[tt-rss.git] / lib / dojo / _base / query-sizzle.js
CommitLineData
2f01fe57
AD
1/*
2 Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
5*/
6
7
8if(!dojo._hasResource["dojo._base.query"]){
9dojo._hasResource["dojo._base.query"]=true;
10if(typeof dojo!="undefined"){
11dojo.provide("dojo._base.query");
12dojo.require("dojo._base.NodeList");
13dojo.query=function(_1,_2,_3){
14_3=_3||dojo.NodeList;
15if(!_1){
16return new _3();
17}
18if(_1.constructor==_3){
19return _1;
20}
21if(!dojo.isString(_1)){
22return new _3(_1);
23}
24if(dojo.isString(_2)){
25_2=dojo.byId(_2);
26if(!_2){
27return new _3();
28}
29}
30return dojo.Sizzle(_1,_2,new _3());
31};
32dojo._filterQueryResult=function(_4,_5){
33return dojo.Sizzle.filter(_5,_4);
34};
35}
36(function(ns){
37var _6=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,_7=0,_8=Object.prototype.toString;
38var _9=function(_a,_b,_c,_d){
39_c=_c||[];
40_b=_b||document;
41if(_b.nodeType!==1&&_b.nodeType!==9){
42return [];
43}
44if(!_a||typeof _a!=="string"){
45return _c;
46}
47var _e=[],m,_f,_10,_11,_12,_13,_14=true;
48_6.lastIndex=0;
49while((m=_6.exec(_a))!==null){
50_e.push(m[1]);
51if(m[2]){
52_13=RegExp.rightContext;
53break;
54}
55}
56if(_e.length>1&&_15.match.POS.exec(_a)){
57if(_e.length===2&&_15.relative[_e[0]]){
58var _16="",_17;
59while((_17=_15.match.POS.exec(_a))){
60_16+=_17[0];
61_a=_a.replace(_15.match.POS,"");
62}
63_f=_9.filter(_16,_9(_a,_b));
64}else{
65_f=_15.relative[_e[0]]?[_b]:_9(_e.shift(),_b);
66while(_e.length){
67var _18=[];
68_a=_e.shift();
69if(_15.relative[_a]){
70_a+=_e.shift();
71}
72for(var i=0,l=_f.length;i<l;i++){
73_9(_a,_f[i],_18);
74}
75_f=_18;
76}
77}
78}else{
79var ret=_d?{expr:_e.pop(),set:_19(_d)}:_9.find(_e.pop(),_e.length===1&&_b.parentNode?_b.parentNode:_b);
80_f=_9.filter(ret.expr,ret.set);
81if(_e.length>0){
82_10=_19(_f);
83}else{
84_14=false;
85}
86while(_e.length){
87var cur=_e.pop(),pop=cur;
88if(!_15.relative[cur]){
89cur="";
90}else{
91pop=_e.pop();
92}
93if(pop==null){
94pop=_b;
95}
96_15.relative[cur](_10,pop);
97}
98}
99if(!_10){
100_10=_f;
101}
102if(!_10){
103throw "Syntax error, unrecognized expression: "+(cur||_a);
104}
105if(_8.call(_10)==="[object Array]"){
106if(!_14){
107_c.push.apply(_c,_10);
108}else{
109if(_b.nodeType===1){
110for(var i=0;_10[i]!=null;i++){
111if(_10[i]&&(_10[i]===true||_10[i].nodeType===1&&_1a(_b,_10[i]))){
112_c.push(_f[i]);
113}
114}
115}else{
116for(var i=0;_10[i]!=null;i++){
117if(_10[i]&&_10[i].nodeType===1){
118_c.push(_f[i]);
119}
120}
121}
122}
123}else{
124_19(_10,_c);
125}
126if(_13){
127_9(_13,_b,_c,_d);
128}
129return _c;
130};
131_9.matches=function(_1b,set){
132return _9(_1b,null,null,set);
133};
134_9.find=function(_1c,_1d){
135var set,_1e;
136if(!_1c){
137return [];
138}
139for(var i=0,l=_15.order.length;i<l;i++){
140var _1f=_15.order[i],_1e;
141if((_1e=_15.match[_1f].exec(_1c))){
142var _20=RegExp.leftContext;
143if(_20.substr(_20.length-1)!=="\\"){
144_1e[1]=(_1e[1]||"").replace(/\\/g,"");
145set=_15.find[_1f](_1e,_1d);
146if(set!=null){
147_1c=_1c.replace(_15.match[_1f],"");
148break;
149}
150}
151}
152}
153if(!set){
154set=_1d.getElementsByTagName("*");
155}
156return {set:set,expr:_1c};
157};
158_9.filter=function(_21,set,_22,not){
159var old=_21,_23=[],_24=set,_25,_26;
160while(_21&&set.length){
161for(var _27 in _15.filter){
162if((_25=_15.match[_27].exec(_21))!=null){
163var _28=_15.filter[_27],_29=null,_2a=0,_2b,_2c;
164_26=false;
165if(_24==_23){
166_23=[];
167}
168if(_15.preFilter[_27]){
169_25=_15.preFilter[_27](_25,_24,_22,_23,not);
170if(!_25){
171_26=_2b=true;
172}else{
173if(_25[0]===true){
174_29=[];
175var _2d=null,_2e;
176for(var i=0;(_2e=_24[i])!==undefined;i++){
177if(_2e&&_2d!==_2e){
178_29.push(_2e);
179_2d=_2e;
180}
181}
182}
183}
184}
185if(_25){
186for(var i=0;(_2c=_24[i])!==undefined;i++){
187if(_2c){
188if(_29&&_2c!=_29[_2a]){
189_2a++;
190}
191_2b=_28(_2c,_25,_2a,_29);
192var _2f=not^!!_2b;
193if(_22&&_2b!=null){
194if(_2f){
195_26=true;
196}else{
197_24[i]=false;
198}
199}else{
200if(_2f){
201_23.push(_2c);
202_26=true;
203}
204}
205}
206}
207}
208if(_2b!==undefined){
209if(!_22){
210_24=_23;
211}
212_21=_21.replace(_15.match[_27],"");
213if(!_26){
214return [];
215}
216break;
217}
218}
219}
220_21=_21.replace(/\s*,\s*/,"");
221if(_21==old){
222if(_26==null){
223throw "Syntax error, unrecognized expression: "+_21;
224}else{
225break;
226}
227}
228old=_21;
229}
230return _24;
231};
232var _15=_9.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u0128-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u0128-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u0128-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[((?:[\w\u0128-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\]/,TAG:/^((?:[\w\u0128-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child\(?(even|odd|[\dn+-]*)\)?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)\(?(\d*)\)?(?:[^-]|$)/,PSEUDO:/:((?:[\w\u0128-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},relative:{"+":function(_30,_31){
233for(var i=0,l=_30.length;i<l;i++){
234var _32=_30[i];
235if(_32){
236var cur=_32.previousSibling;
237while(cur&&cur.nodeType!==1){
238cur=cur.previousSibling;
239}
240_30[i]=typeof _31==="string"?cur||false:cur===_31;
241}
242}
243if(typeof _31==="string"){
244_9.filter(_31,_30,true);
245}
246},">":function(_33,_34){
247if(typeof _34==="string"&&!/\W/.test(_34)){
248_34=_34.toUpperCase();
249for(var i=0,l=_33.length;i<l;i++){
250var _35=_33[i];
251if(_35){
252var _36=_35.parentNode;
253_33[i]=_36.nodeName===_34?_36:false;
254}
255}
256}else{
257for(var i=0,l=_33.length;i<l;i++){
258var _35=_33[i];
259if(_35){
260_33[i]=typeof _34==="string"?_35.parentNode:_35.parentNode===_34;
261}
262}
263if(typeof _34==="string"){
264_9.filter(_34,_33,true);
265}
266}
267},"":function(_37,_38){
268var _39="done"+(_7++),_3a=_3b;
269if(!_38.match(/\W/)){
270var _3c=_38=_38.toUpperCase();
271_3a=_3d;
272}
273_3a("parentNode",_38,_39,_37,_3c);
274},"~":function(_3e,_3f){
275var _40="done"+(_7++),_41=_3b;
276if(typeof _3f==="string"&&!_3f.match(/\W/)){
277var _42=_3f=_3f.toUpperCase();
278_41=_3d;
279}
280_41("previousSibling",_3f,_40,_3e,_42);
281}},find:{ID:function(_43,_44){
282if(_44.getElementById){
283var m=_44.getElementById(_43[1]);
284return m?[m]:[];
285}
286},NAME:function(_45,_46){
287return _46.getElementsByName?_46.getElementsByName(_45[1]):null;
288},TAG:function(_47,_48){
289return _48.getElementsByTagName(_47[1]);
290}},preFilter:{CLASS:function(_49,_4a,_4b,_4c,not){
291_49=" "+_49[1].replace(/\\/g,"")+" ";
292for(var i=0;_4a[i];i++){
293if(not^(" "+_4a[i].className+" ").indexOf(_49)>=0){
294if(!_4b){
295_4c.push(_4a[i]);
296}
297}else{
298if(_4b){
299_4a[i]=false;
300}
301}
302}
303return false;
304},ID:function(_4d){
305return _4d[1];
306},TAG:function(_4e){
307return _4e[1].toUpperCase();
308},CHILD:function(_4f){
309if(_4f[1]=="nth"){
310var _50=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(_4f[2]=="even"&&"2n"||_4f[2]=="odd"&&"2n+1"||!/\D/.test(_4f[2])&&"0n+"+_4f[2]||_4f[2]);
311_4f[2]=(_50[1]+(_50[2]||1))-0;
312_4f[3]=_50[3]-0;
313}
314_4f[0]="done"+(_7++);
315return _4f;
316},ATTR:function(_51){
317var _52=_51[1];
318if(_15.attrMap[_52]){
319_51[1]=_15.attrMap[_52];
320}
321if(_51[2]==="~="){
322_51[4]=" "+_51[4]+" ";
323}
324return _51;
325},PSEUDO:function(_53,_54,_55,_56,not){
326if(_53[1]==="not"){
327if(_53[3].match(_6).length>1){
328_53[3]=_9(_53[3],null,null,_54);
329}else{
330var ret=_9.filter(_53[3],_54,_55,true^not);
331if(!_55){
332_56.push.apply(_56,ret);
333}
334return false;
335}
336}
337return _53;
338},POS:function(_57){
339_57.unshift(true);
340return _57;
341}},filters:{enabled:function(_58){
342return _58.disabled===false&&_58.type!=="hidden";
343},disabled:function(_59){
344return _59.disabled===true;
345},checked:function(_5a){
346return _5a.checked===true;
347},selected:function(_5b){
348_5b.parentNode.selectedIndex;
349return _5b.selected===true;
350},parent:function(_5c){
351return !!_5c.firstChild;
352},empty:function(_5d){
353return !_5d.firstChild;
354},has:function(_5e,i,_5f){
355return !!_9(_5f[3],_5e).length;
356},header:function(_60){
357return /h\d/i.test(_60.nodeName);
358},text:function(_61){
359return "text"===_61.type;
360},radio:function(_62){
361return "radio"===_62.type;
362},checkbox:function(_63){
363return "checkbox"===_63.type;
364},file:function(_64){
365return "file"===_64.type;
366},password:function(_65){
367return "password"===_65.type;
368},submit:function(_66){
369return "submit"===_66.type;
370},image:function(_67){
371return "image"===_67.type;
372},reset:function(_68){
373return "reset"===_68.type;
374},button:function(_69){
375return "button"===_69.type||_69.nodeName.toUpperCase()==="BUTTON";
376},input:function(_6a){
377return /input|select|textarea|button/i.test(_6a.nodeName);
378}},setFilters:{first:function(_6b,i){
379return i===0;
380},last:function(_6c,i,_6d,_6e){
381return i===_6e.length-1;
382},even:function(_6f,i){
383return i%2===0;
384},odd:function(_70,i){
385return i%2===1;
386},lt:function(_71,i,_72){
387return i<_72[3]-0;
388},gt:function(_73,i,_74){
389return i>_74[3]-0;
390},nth:function(_75,i,_76){
391return _76[3]-0==i;
392},eq:function(_77,i,_78){
393return _78[3]-0==i;
394}},filter:{CHILD:function(_79,_7a){
395var _7b=_7a[1],_7c=_79.parentNode;
396var _7d=_7a[0];
397if(_7c&&!_7c[_7d]){
398var _7e=1;
399for(var _7f=_7c.firstChild;_7f;_7f=_7f.nextSibling){
400if(_7f.nodeType==1){
401_7f.nodeIndex=_7e++;
402}
403}
404_7c[_7d]=_7e-1;
405}
406if(_7b=="first"){
407return _79.nodeIndex==1;
408}else{
409if(_7b=="last"){
410return _79.nodeIndex==_7c[_7d];
411}else{
412if(_7b=="only"){
413return _7c[_7d]==1;
414}else{
415if(_7b=="nth"){
416var add=false,_80=_7a[2],_81=_7a[3];
417if(_80==1&&_81==0){
418return true;
419}
420if(_80==0){
421if(_79.nodeIndex==_81){
422add=true;
423}
424}else{
425if((_79.nodeIndex-_81)%_80==0&&(_79.nodeIndex-_81)/_80>=0){
426add=true;
427}
428}
429return add;
430}
431}
432}
433}
434},PSEUDO:function(_82,_83,i,_84){
435var _85=_83[1],_86=_15.filters[_85];
436if(_86){
437return _86(_82,i,_83,_84);
438}else{
439if(_85==="contains"){
440return (_82.textContent||_82.innerText||"").indexOf(_83[3])>=0;
441}else{
442if(_85==="not"){
443var not=_83[3];
444for(var i=0,l=not.length;i<l;i++){
445if(not[i]===_82){
446return false;
447}
448}
449return true;
450}
451}
452}
453},ID:function(_87,_88){
454return _87.nodeType===1&&_87.getAttribute("id")===_88;
455},TAG:function(_89,_8a){
456return (_8a==="*"&&_89.nodeType===1)||_89.nodeName===_8a;
457},CLASS:function(_8b,_8c){
458return _8c.test(_8b.className);
459},ATTR:function(_8d,_8e){
460var _8f=_8d[_8e[1]]||_8d.getAttribute(_8e[1]),_90=_8f+"",_91=_8e[2],_92=_8e[4];
461return _8f==null?false:_91==="="?_90===_92:_91==="*="?_90.indexOf(_92)>=0:_91==="~="?(" "+_90+" ").indexOf(_92)>=0:!_8e[4]?_8f:_91==="!="?_90!=_92:_91==="^="?_90.indexOf(_92)===0:_91==="$="?_90.substr(_90.length-_92.length)===_92:_91==="|="?_90===_92||_90.substr(0,_92.length+1)===_92+"-":false;
462},POS:function(_93,_94,i,_95){
463var _96=_94[2],_97=_15.setFilters[_96];
464if(_97){
465return _97(_93,i,_94,_95);
466}
467}}};
468for(var _98 in _15.match){
469_15.match[_98]=RegExp(_15.match[_98].source+/(?![^\[]*\])(?![^\(]*\))/.source);
470}
471var _19=function(_99,_9a){
472_99=Array.prototype.slice.call(_99);
473if(_9a){
474_9a.push.apply(_9a,_99);
475return _9a;
476}
477return _99;
478};
479try{
480Array.prototype.slice.call(document.documentElement.childNodes);
481}
482catch(e){
483_19=function(_9b,_9c){
484var ret=_9c||[];
485if(_8.call(_9b)==="[object Array]"){
486Array.prototype.push.apply(ret,_9b);
487}else{
488if(typeof _9b.length==="number"){
489for(var i=0,l=_9b.length;i<l;i++){
490ret.push(_9b[i]);
491}
492}else{
493for(var i=0;_9b[i];i++){
494ret.push(_9b[i]);
495}
496}
497}
498return ret;
499};
500}
501(function(){
502var _9d=document.createElement("form"),id="script"+(new Date).getTime();
503_9d.innerHTML="<input name='"+id+"'/>";
504var _9e=document.documentElement;
505_9e.insertBefore(_9d,_9e.firstChild);
506if(!!document.getElementById(id)){
507_15.find.ID=function(_9f,_a0){
508if(_a0.getElementById){
509var m=_a0.getElementById(_9f[1]);
510return m?m.id===_9f[1]||m.getAttributeNode&&m.getAttributeNode("id").nodeValue===_9f[1]?[m]:undefined:[];
511}
512};
513_15.filter.ID=function(_a1,_a2){
514var _a3=_a1.getAttributeNode&&_a1.getAttributeNode("id");
515return _a1.nodeType===1&&_a3&&_a3.nodeValue===_a2;
516};
517}
518_9e.removeChild(_9d);
519})();
520(function(){
521var div=document.createElement("div");
522div.appendChild(document.createComment(""));
523if(div.getElementsByTagName("*").length>0){
524_15.find.TAG=function(_a4,_a5){
525var _a6=_a5.getElementsByTagName(_a4[1]);
526if(_a4[1]==="*"){
527var tmp=[];
528for(var i=0;_a6[i];i++){
529if(_a6[i].nodeType===1){
530tmp.push(_a6[i]);
531}
532}
533_a6=tmp;
534}
535return _a6;
536};
537}
538})();
539if(document.querySelectorAll){
540(function(){
541var _a7=_9;
542_9=function(_a8,_a9,_aa,_ab){
543_a9=_a9||document;
544if(!_ab&&_a9.nodeType===9){
545try{
546return _19(_a9.querySelectorAll(_a8),_aa);
547}
548catch(e){
549}
550}
551return _a7(_a8,_a9,_aa,_ab);
552};
553_9.find=_a7.find;
554_9.filter=_a7.filter;
555_9.selectors=_a7.selectors;
556_9.matches=_a7.matches;
557})();
558}
559if(document.documentElement.getElementsByClassName){
560_15.order.splice(1,0,"CLASS");
561_15.find.CLASS=function(_ac,_ad){
562return _ad.getElementsByClassName(_ac[1]);
563};
564}
565function _3d(dir,cur,_ae,_af,_b0){
566for(var i=0,l=_af.length;i<l;i++){
567var _b1=_af[i];
568if(_b1){
569_b1=_b1[dir];
570var _b2=false;
571while(_b1&&_b1.nodeType){
572var _b3=_b1[_ae];
573if(_b3){
574_b2=_af[_b3];
575break;
576}
577if(_b1.nodeType===1){
578_b1[_ae]=i;
579}
580if(_b1.nodeName===cur){
581_b2=_b1;
582break;
583}
584_b1=_b1[dir];
585}
586_af[i]=_b2;
587}
588}
589};
590function _3b(dir,cur,_b4,_b5,_b6){
591for(var i=0,l=_b5.length;i<l;i++){
592var _b7=_b5[i];
593if(_b7){
594_b7=_b7[dir];
595var _b8=false;
596while(_b7&&_b7.nodeType){
597if(_b7[_b4]){
598_b8=_b5[_b7[_b4]];
599break;
600}
601if(_b7.nodeType===1){
602_b7[_b4]=i;
603if(typeof cur!=="string"){
604if(_b7===cur){
605_b8=true;
606break;
607}
608}else{
609if(_9.filter(cur,[_b7]).length>0){
610_b8=_b7;
611break;
612}
613}
614}
615_b7=_b7[dir];
616}
617_b5[i]=_b8;
618}
619}
620};
621var _1a=document.compareDocumentPosition?function(a,b){
622return a.compareDocumentPosition(b)&16;
623}:function(a,b){
624return a!==b&&(a.contains?a.contains(b):true);
625};
626(ns||window).Sizzle=_9;
627})(typeof dojo=="undefined"?null:dojo);
628}