3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>The source code</title>
\r
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
8 <body onload="prettyPrint();">
\r
9 <pre class="prettyprint lang-js">/*
\r
10 * This is code is also distributed under MIT license for use
\r
11 * with jQuery and prototype JavaScript libraries.
\r
13 <div id="cls-Ext.DomQuery"></div>/**
\r
14 * @class Ext.DomQuery
\r
15 Provides high performance selector/xpath processing by compiling queries into reusable functions. New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in).
\r
17 DomQuery supports most of the <a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215/#selectors">CSS3 selectors spec</a>, along with some custom selectors and basic XPath.</p>
\r
20 All selectors, attribute filters and pseudos below can be combined infinitely in any order. For example "div.foo:nth-child(odd)[@foo=bar].bar:first" would be a perfectly valid selector. Node filters are processed in the order in which they appear, which allows you to optimize your queries for your document structure.
\r
22 <h4>Element Selectors:</h4>
\r
24 <li> <b>*</b> any element</li>
\r
25 <li> <b>E</b> an element with the tag E</li>
\r
26 <li> <b>E F</b> All descendent elements of E that have the tag F</li>
\r
27 <li> <b>E > F</b> or <b>E/F</b> all direct children elements of E that have the tag F</li>
\r
28 <li> <b>E + F</b> all elements with the tag F that are immediately preceded by an element with the tag E</li>
\r
29 <li> <b>E ~ F</b> all elements with the tag F that are preceded by a sibling element with the tag E</li>
\r
31 <h4>Attribute Selectors:</h4>
\r
32 <p>The use of @ and quotes are optional. For example, div[@foo='bar'] is also a valid attribute selector.</p>
\r
34 <li> <b>E[foo]</b> has an attribute "foo"</li>
\r
35 <li> <b>E[foo=bar]</b> has an attribute "foo" that equals "bar"</li>
\r
36 <li> <b>E[foo^=bar]</b> has an attribute "foo" that starts with "bar"</li>
\r
37 <li> <b>E[foo$=bar]</b> has an attribute "foo" that ends with "bar"</li>
\r
38 <li> <b>E[foo*=bar]</b> has an attribute "foo" that contains the substring "bar"</li>
\r
39 <li> <b>E[foo%=2]</b> has an attribute "foo" that is evenly divisible by 2</li>
\r
40 <li> <b>E[foo!=bar]</b> has an attribute "foo" that does not equal "bar"</li>
\r
42 <h4>Pseudo Classes:</h4>
\r
44 <li> <b>E:first-child</b> E is the first child of its parent</li>
\r
45 <li> <b>E:last-child</b> E is the last child of its parent</li>
\r
46 <li> <b>E:nth-child(<i>n</i>)</b> E is the <i>n</i>th child of its parent (1 based as per the spec)</li>
\r
47 <li> <b>E:nth-child(odd)</b> E is an odd child of its parent</li>
\r
48 <li> <b>E:nth-child(even)</b> E is an even child of its parent</li>
\r
49 <li> <b>E:only-child</b> E is the only child of its parent</li>
\r
50 <li> <b>E:checked</b> E is an element that is has a checked attribute that is true (e.g. a radio or checkbox) </li>
\r
51 <li> <b>E:first</b> the first E in the resultset</li>
\r
52 <li> <b>E:last</b> the last E in the resultset</li>
\r
53 <li> <b>E:nth(<i>n</i>)</b> the <i>n</i>th E in the resultset (1 based)</li>
\r
54 <li> <b>E:odd</b> shortcut for :nth-child(odd)</li>
\r
55 <li> <b>E:even</b> shortcut for :nth-child(even)</li>
\r
56 <li> <b>E:contains(foo)</b> E's innerHTML contains the substring "foo"</li>
\r
57 <li> <b>E:nodeValue(foo)</b> E contains a textNode with a nodeValue that equals "foo"</li>
\r
58 <li> <b>E:not(S)</b> an E element that does not match simple selector S</li>
\r
59 <li> <b>E:has(S)</b> an E element that has a descendent that matches simple selector S</li>
\r
60 <li> <b>E:next(S)</b> an E element whose next sibling matches simple selector S</li>
\r
61 <li> <b>E:prev(S)</b> an E element whose previous sibling matches simple selector S</li>
\r
63 <h4>CSS Value Selectors:</h4>
\r
65 <li> <b>E{display=none}</b> css value "display" that equals "none"</li>
\r
66 <li> <b>E{display^=none}</b> css value "display" that starts with "none"</li>
\r
67 <li> <b>E{display$=none}</b> css value "display" that ends with "none"</li>
\r
68 <li> <b>E{display*=none}</b> css value "display" that contains the substring "none"</li>
\r
69 <li> <b>E{display%=2}</b> css value "display" that is evenly divisible by 2</li>
\r
70 <li> <b>E{display!=none}</b> css value "display" that does not equal "none"</li>
\r
74 Ext.DomQuery = function(){
\r
79 trimRe = /^\s+|\s+$/g,
\r
80 tplRe = /\{(\d+)\}/g,
\r
81 modeRe = /^(\s?[\/>+~]\s?|\s|$)/,
\r
82 tagTokenRe = /^(#)?([\w-\*]+)/,
\r
83 nthRe = /(\d*)n\+?(\d*)/,
\r
85 // This is for IE MSXML which does not support expandos.
\r
86 // IE runs the same speed using setAttribute, however FF slows way down
\r
87 // and Safari completely fails so they need to continue to use expandos.
\r
88 isIE = window.ActiveXObject ? true : false,
\r
91 // this eval is stop the compressor from
\r
92 // renaming the variable to something shorter
\r
93 eval("var batch = 30803;");
\r
95 function child(p, index){
\r
99 if(n.nodeType == 1){
\r
110 while((n = n.nextSibling) && n.nodeType != 1);
\r
115 while((n = n.previousSibling) && n.nodeType != 1);
\r
119 function children(d){
\r
120 var n = d.firstChild, ni = -1,
\r
123 nx = n.nextSibling;
\r
124 if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
\r
127 n.nodeIndex = ++ni;
\r
134 function byClassName(c, a, v){
\r
138 var r = [], ri = -1, cn;
\r
139 for(var i = 0, ci; ci = c[i]; i++){
\r
140 if((' '+ci.className+' ').indexOf(v) != -1){
\r
147 function attrValue(n, attr){
\r
148 if(!n.tagName && typeof n.length != "undefined"){
\r
157 if(attr == "class" || attr == "className"){
\r
158 return n.className;
\r
160 return n.getAttribute(attr) || n[attr];
\r
164 function getNodes(ns, mode, tagName){
\r
165 var result = [], ri = -1, cs;
\r
169 tagName = tagName || "*";
\r
170 if(typeof ns.getElementsByTagName != "undefined"){
\r
174 for(var i = 0, ni; ni = ns[i]; i++){
\r
175 cs = ni.getElementsByTagName(tagName);
\r
176 for(var j = 0, ci; ci = cs[j]; j++){
\r
180 }else if(mode == "/" || mode == ">"){
\r
181 var utag = tagName.toUpperCase();
\r
182 for(var i = 0, ni, cn; ni = ns[i]; i++){
\r
183 cn = ni.childNodes;
\r
184 for(var j = 0, cj; cj = cn[j]; j++){
\r
185 if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){
\r
190 }else if(mode == "+"){
\r
191 var utag = tagName.toUpperCase();
\r
192 for(var i = 0, n; n = ns[i]; i++){
\r
193 while((n = n.nextSibling) && n.nodeType != 1);
\r
194 if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
\r
198 }else if(mode == "~"){
\r
199 var utag = tagName.toUpperCase();
\r
200 for(var i = 0, n; n = ns[i]; i++){
\r
201 while((n = n.nextSibling)){
\r
202 if (n.nodeName == utag || n.nodeName == tagName || tagName == '*'){
\r
211 function concat(a, b){
\r
213 return a.concat(b);
\r
215 for(var i = 0, l = b.length; i < l; i++){
\r
216 a[a.length] = b[i];
\r
221 function byTag(cs, tagName){
\r
222 if(cs.tagName || cs == document){
\r
228 var r = [], ri = -1;
\r
229 tagName = tagName.toLowerCase();
\r
230 for(var i = 0, ci; ci = cs[i]; i++){
\r
231 if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){
\r
238 function byId(cs, attr, id){
\r
239 if(cs.tagName || cs == document){
\r
245 var r = [], ri = -1;
\r
246 for(var i = 0,ci; ci = cs[i]; i++){
\r
247 if(ci && ci.id == id){
\r
255 function byAttribute(cs, attr, value, op, custom){
\r
259 f = Ext.DomQuery.operators[op];
\r
260 for(var i = 0, ci; ci = cs[i]; i++){
\r
261 if(ci.nodeType != 1){
\r
266 a = Ext.DomQuery.getStyle(ci, attr);
\r
268 else if(attr == "class" || attr == "className"){
\r
270 }else if(attr == "for"){
\r
272 }else if(attr == "href"){
\r
273 a = ci.getAttribute("href", 2);
\r
275 a = ci.getAttribute(attr);
\r
277 if((f && f(a, value)) || (!f && a)){
\r
284 function byPseudo(cs, name, value){
\r
285 return Ext.DomQuery.pseudos[name](cs, value);
\r
288 function nodupIEXml(cs){
\r
291 cs[0].setAttribute("_nodup", d);
\r
293 for(var i = 1, len = cs.length; i < len; i++){
\r
295 if(!c.getAttribute("_nodup") != d){
\r
296 c.setAttribute("_nodup", d);
\r
300 for(var i = 0, len = cs.length; i < len; i++){
\r
301 cs[i].removeAttribute("_nodup");
\r
306 function nodup(cs){
\r
310 var len = cs.length, c, i, r = cs, cj, ri = -1;
\r
311 if(!len || typeof cs.nodeType != "undefined" || len == 1){
\r
314 if(isIE && typeof cs[0].selectSingleNode != "undefined"){
\r
315 return nodupIEXml(cs);
\r
319 for(i = 1; c = cs[i]; i++){
\r
324 for(var j = 0; j < i; j++){
\r
327 for(j = i+1; cj = cs[j]; j++){
\r
328 if(cj._nodup != d){
\r
339 function quickDiffIEXml(c1, c2){
\r
342 for(var i = 0, len = c1.length; i < len; i++){
\r
343 c1[i].setAttribute("_qdiff", d);
\r
345 for(var i = 0, len = c2.length; i < len; i++){
\r
346 if(c2[i].getAttribute("_qdiff") != d){
\r
347 r[r.length] = c2[i];
\r
350 for(var i = 0, len = c1.length; i < len; i++){
\r
351 c1[i].removeAttribute("_qdiff");
\r
356 function quickDiff(c1, c2){
\r
357 var len1 = c1.length,
\r
363 if(isIE && typeof c1[0].selectSingleNode != "undefined"){
\r
364 return quickDiffIEXml(c1, c2);
\r
366 for(var i = 0; i < len1; i++){
\r
369 for(var i = 0, len = c2.length; i < len; i++){
\r
370 if(c2[i]._qdiff != d){
\r
371 r[r.length] = c2[i];
\r
377 function quickId(ns, mode, root, id){
\r
379 var d = root.ownerDocument || root;
\r
380 return d.getElementById(id);
\r
382 ns = getNodes(ns, mode, "*");
\r
383 return byId(ns, null, id);
\r
387 getStyle : function(el, name){
\r
388 return Ext.fly(el).getStyle(name);
\r
390 <div id="method-Ext.DomQuery-compile"></div>/**
\r
391 * Compiles a selector/xpath query into a reusable function. The returned function
\r
392 * takes one parameter "root" (optional), which is the context node from where the query should start.
\r
393 * @param {String} selector The selector/xpath query
\r
394 * @param {String} type (optional) Either "select" (the default) or "simple" for a simple selector match
\r
395 * @return {Function}
\r
397 compile : function(path, type){
\r
398 type = type || "select";
\r
400 var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"],
\r
401 q = path, mode, lq,
\r
402 tk = Ext.DomQuery.matchers,
\r
405 // accept leading mode switch
\r
406 lmode = q.match(modeRe);
\r
408 if(lmode && lmode[1]){
\r
409 fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
\r
410 q = q.replace(lmode[1], "");
\r
412 // strip leading slashes
\r
413 while(path.substr(0, 1)=="/"){
\r
414 path = path.substr(1);
\r
417 while(q && lq != q){
\r
419 var tm = q.match(tagTokenRe);
\r
420 if(type == "select"){
\r
423 fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");';
\r
425 fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");';
\r
427 q = q.replace(tm[0], "");
\r
428 }else if(q.substr(0, 1) != '@'){
\r
429 fn[fn.length] = 'n = getNodes(n, mode, "*");';
\r
434 fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");';
\r
436 fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");';
\r
438 q = q.replace(tm[0], "");
\r
441 while(!(mm = q.match(modeRe))){
\r
442 var matched = false;
\r
443 for(var j = 0; j < tklen; j++){
\r
445 var m = q.match(t.re);
\r
447 fn[fn.length] = t.select.replace(tplRe, function(x, i){
\r
450 q = q.replace(m[0], "");
\r
455 // prevent infinite loop on bad selector
\r
457 throw 'Error parsing selector, parsing failed at "' + q + '"';
\r
461 fn[fn.length] = 'mode="'+mm[1].replace(trimRe, "")+'";';
\r
462 q = q.replace(mm[1], "");
\r
465 fn[fn.length] = "return nodup(n);\n}";
\r
470 <div id="method-Ext.DomQuery-select"></div>/**
\r
471 * Selects a group of elements.
\r
472 * @param {String} selector The selector/xpath query (can be a comma separated list of selectors)
\r
473 * @param {Node} root (optional) The start of the query (defaults to document).
\r
474 * @return {Array} An Array of DOM elements which match the selector. If there are
\r
475 * no matches, and empty Array is returned.
\r
477 select : function(path, root, type){
\r
478 if(!root || root == document){
\r
481 if(typeof root == "string"){
\r
482 root = document.getElementById(root);
\r
484 var paths = path.split(","),
\r
486 for(var i = 0, len = paths.length; i < len; i++){
\r
487 var p = paths[i].replace(trimRe, "");
\r
489 cache[p] = Ext.DomQuery.compile(p);
\r
491 throw p + " is not a valid selector";
\r
494 var result = cache[p](root);
\r
495 if(result && result != document){
\r
496 results = results.concat(result);
\r
499 if(paths.length > 1){
\r
500 return nodup(results);
\r
505 <div id="method-Ext.DomQuery-selectNode"></div>/**
\r
506 * Selects a single element.
\r
507 * @param {String} selector The selector/xpath query
\r
508 * @param {Node} root (optional) The start of the query (defaults to document).
\r
509 * @return {Element} The DOM element which matched the selector.
\r
511 selectNode : function(path, root){
\r
512 return Ext.DomQuery.select(path, root)[0];
\r
515 <div id="method-Ext.DomQuery-selectValue"></div>/**
\r
516 * Selects the value of a node, optionally replacing null with the defaultValue.
\r
517 * @param {String} selector The selector/xpath query
\r
518 * @param {Node} root (optional) The start of the query (defaults to document).
\r
519 * @param {String} defaultValue
\r
522 selectValue : function(path, root, defaultValue){
\r
523 path = path.replace(trimRe, "");
\r
524 if(!valueCache[path]){
\r
525 valueCache[path] = Ext.DomQuery.compile(path, "select");
\r
527 var n = valueCache[path](root), v;
\r
528 n = n[0] ? n[0] : n;
\r
530 if (typeof n.normalize == 'function') n.normalize();
\r
532 v = (n && n.firstChild ? n.firstChild.nodeValue : null);
\r
533 return ((v === null||v === undefined||v==='') ? defaultValue : v);
\r
536 <div id="method-Ext.DomQuery-selectNumber"></div>/**
\r
537 * Selects the value of a node, parsing integers and floats. Returns the defaultValue, or 0 if none is specified.
\r
538 * @param {String} selector The selector/xpath query
\r
539 * @param {Node} root (optional) The start of the query (defaults to document).
\r
540 * @param {Number} defaultValue
\r
543 selectNumber : function(path, root, defaultValue){
\r
544 var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
\r
545 return parseFloat(v);
\r
548 <div id="method-Ext.DomQuery-is"></div>/**
\r
549 * Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)
\r
550 * @param {String/HTMLElement/Array} el An element id, element or array of elements
\r
551 * @param {String} selector The simple selector to test
\r
552 * @return {Boolean}
\r
554 is : function(el, ss){
\r
555 if(typeof el == "string"){
\r
556 el = document.getElementById(el);
\r
558 var isArray = Ext.isArray(el),
\r
559 result = Ext.DomQuery.filter(isArray ? el : [el], ss);
\r
560 return isArray ? (result.length == el.length) : (result.length > 0);
\r
563 <div id="method-Ext.DomQuery-filter"></div>/**
\r
564 * Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)
\r
565 * @param {Array} el An array of elements to filter
\r
566 * @param {String} selector The simple selector to test
\r
567 * @param {Boolean} nonMatches If true, it returns the elements that DON'T match
\r
568 * the selector instead of the ones that match
\r
569 * @return {Array} An Array of DOM elements which match the selector. If there are
\r
570 * no matches, and empty Array is returned.
\r
572 filter : function(els, ss, nonMatches){
\r
573 ss = ss.replace(trimRe, "");
\r
574 if(!simpleCache[ss]){
\r
575 simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
\r
577 var result = simpleCache[ss](els);
\r
578 return nonMatches ? quickDiff(result, els) : result;
\r
581 <div id="prop-Ext.DomQuery-matchers"></div>/**
\r
582 * Collection of matching regular expressions and code snippets.
\r
586 select: 'n = byClassName(n, null, " {1} ");'
\r
588 re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
\r
589 select: 'n = byPseudo(n, "{1}", "{2}");'
\r
591 re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
\r
592 select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
\r
595 select: 'n = byId(n, null, "{1}");'
\r
598 select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
\r
602 <div id="method-Ext.DomQuery-operators"></div>/**
\r
603 * Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *=, %=, |= and ~=.
\r
604 * New operators can be added as long as the match the format <i>c</i>= where <i>c</i> is any character other than space, > <.
\r
607 "=" : function(a, v){
\r
610 "!=" : function(a, v){
\r
613 "^=" : function(a, v){
\r
614 return a && a.substr(0, v.length) == v;
\r
616 "$=" : function(a, v){
\r
617 return a && a.substr(a.length-v.length) == v;
\r
619 "*=" : function(a, v){
\r
620 return a && a.indexOf(v) !== -1;
\r
622 "%=" : function(a, v){
\r
623 return (a % v) == 0;
\r
625 "|=" : function(a, v){
\r
626 return a && (a == v || a.substr(0, v.length+1) == v+'-');
\r
628 "~=" : function(a, v){
\r
629 return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
\r
633 <div id="prop-Ext.DomQuery-pseudos"></div>/**
\r
634 * <p>Object hash of "pseudo class" filter functions which are used when filtering selections. Each function is passed
\r
635 * two parameters:</p><div class="mdetail-params"><ul>
\r
636 * <li><b>c</b> : Array<div class="sub-desc">An Array of DOM elements to filter.</div></li>
\r
637 * <li><b>v</b> : String<div class="sub-desc">The argument (if any) supplied in the selector.</div></li>
\r
639 * <p>A filter function returns an Array of DOM elements which conform to the pseudo class.</p>
\r
640 * <p>In addition to the provided pseudo classes listed above such as <code>first-child</code> and <code>nth-child</code>,
\r
641 * developers may add additional, custom psuedo class filters to select elements according to application-specific requirements.</p>
\r
642 * <p>For example, to filter <code><a></code> elements to only return links to <i>external</i> resources:</p>
\r
644 Ext.DomQuery.pseudos.external = function(c, v){
\r
645 var r = [], ri = -1;
\r
646 for(var i = 0, ci; ci = c[i]; i++){
\r
647 // Include in result set only if it's a link to an external resource
\r
648 if(ci.hostname != location.hostname){
\r
654 * Then external links could be gathered with the following statement:<code><pre>
\r
655 var externalLinks = Ext.select("a:external");
\r
659 "first-child" : function(c){
\r
660 var r = [], ri = -1, n;
\r
661 for(var i = 0, ci; ci = n = c[i]; i++){
\r
662 while((n = n.previousSibling) && n.nodeType != 1);
\r
670 "last-child" : function(c){
\r
671 var r = [], ri = -1, n;
\r
672 for(var i = 0, ci; ci = n = c[i]; i++){
\r
673 while((n = n.nextSibling) && n.nodeType != 1);
\r
681 "nth-child" : function(c, a) {
\r
682 var r = [], ri = -1,
\r
683 m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a),
\r
684 f = (m[1] || 1) - 0, l = m[2] - 0;
\r
685 for(var i = 0, n; n = c[i]; i++){
\r
686 var pn = n.parentNode;
\r
687 if (batch != pn._batch) {
\r
689 for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
\r
690 if(cn.nodeType == 1){
\r
691 cn.nodeIndex = ++j;
\r
697 if (l == 0 || n.nodeIndex == l){
\r
700 } else if ((n.nodeIndex + l) % f == 0){
\r
708 "only-child" : function(c){
\r
709 var r = [], ri = -1;;
\r
710 for(var i = 0, ci; ci = c[i]; i++){
\r
711 if(!prev(ci) && !next(ci)){
\r
718 "empty" : function(c){
\r
719 var r = [], ri = -1;
\r
720 for(var i = 0, ci; ci = c[i]; i++){
\r
721 var cns = ci.childNodes, j = 0, cn, empty = true;
\r
722 while(cn = cns[j]){
\r
724 if(cn.nodeType == 1 || cn.nodeType == 3){
\r
736 "contains" : function(c, v){
\r
737 var r = [], ri = -1;
\r
738 for(var i = 0, ci; ci = c[i]; i++){
\r
739 if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
\r
746 "nodeValue" : function(c, v){
\r
747 var r = [], ri = -1;
\r
748 for(var i = 0, ci; ci = c[i]; i++){
\r
749 if(ci.firstChild && ci.firstChild.nodeValue == v){
\r
756 "checked" : function(c){
\r
757 var r = [], ri = -1;
\r
758 for(var i = 0, ci; ci = c[i]; i++){
\r
759 if(ci.checked == true){
\r
766 "not" : function(c, ss){
\r
767 return Ext.DomQuery.filter(c, ss, true);
\r
770 "any" : function(c, selectors){
\r
771 var ss = selectors.split('|'),
\r
772 r = [], ri = -1, s;
\r
773 for(var i = 0, ci; ci = c[i]; i++){
\r
774 for(var j = 0; s = ss[j]; j++){
\r
775 if(Ext.DomQuery.is(ci, s)){
\r
784 "odd" : function(c){
\r
785 return this["nth-child"](c, "odd");
\r
788 "even" : function(c){
\r
789 return this["nth-child"](c, "even");
\r
792 "nth" : function(c, a){
\r
793 return c[a-1] || [];
\r
796 "first" : function(c){
\r
800 "last" : function(c){
\r
801 return c[c.length-1] || [];
\r
804 "has" : function(c, ss){
\r
805 var s = Ext.DomQuery.select,
\r
807 for(var i = 0, ci; ci = c[i]; i++){
\r
808 if(s(ss, ci).length > 0){
\r
815 "next" : function(c, ss){
\r
816 var is = Ext.DomQuery.is,
\r
818 for(var i = 0, ci; ci = c[i]; i++){
\r
820 if(n && is(n, ss)){
\r
827 "prev" : function(c, ss){
\r
828 var is = Ext.DomQuery.is,
\r
830 for(var i = 0, ci; ci = c[i]; i++){
\r
832 if(n && is(n, ss)){
\r
842 <div id="method-Ext-query"></div>/**
\r
843 * Selects an array of DOM nodes by CSS/XPath selector. Shorthand of {@link Ext.DomQuery#select}
\r
844 * @param {String} path The selector/xpath query
\r
845 * @param {Node} root (optional) The start of the query (defaults to document).
\r
850 Ext.query = Ext.DomQuery.select;
\r