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