4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js">/*
19 * This is code is also distributed under MIT license for use
20 * with jQuery and prototype JavaScript libraries.
22 <span id='Ext-DomQuery'>/**
23 </span> * @class Ext.DomQuery
24 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).
26 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>
29 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.
31 <h4>Element Selectors:</h4>
32 <ul class="list">
33 <li> <b>*</b> any element</li>
34 <li> <b>E</b> an element with the tag E</li>
35 <li> <b>E F</b> All descendent elements of E that have the tag F</li>
36 <li> <b>E > F</b> or <b>E/F</b> all direct children elements of E that have the tag F</li>
37 <li> <b>E + F</b> all elements with the tag F that are immediately preceded by an element with the tag E</li>
38 <li> <b>E ~ F</b> all elements with the tag F that are preceded by a sibling element with the tag E</li>
40 <h4>Attribute Selectors:</h4>
41 <p>The use of &#64; and quotes are optional. For example, div[&#64;foo='bar'] is also a valid attribute selector.</p>
42 <ul class="list">
43 <li> <b>E[foo]</b> has an attribute "foo"</li>
44 <li> <b>E[foo=bar]</b> has an attribute "foo" that equals "bar"</li>
45 <li> <b>E[foo^=bar]</b> has an attribute "foo" that starts with "bar"</li>
46 <li> <b>E[foo$=bar]</b> has an attribute "foo" that ends with "bar"</li>
47 <li> <b>E[foo*=bar]</b> has an attribute "foo" that contains the substring "bar"</li>
48 <li> <b>E[foo%=2]</b> has an attribute "foo" that is evenly divisible by 2</li>
49 <li> <b>E[foo!=bar]</b> attribute "foo" does not equal "bar"</li>
51 <h4>Pseudo Classes:</h4>
52 <ul class="list">
53 <li> <b>E:first-child</b> E is the first child of its parent</li>
54 <li> <b>E:last-child</b> E is the last child of its parent</li>
55 <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>
56 <li> <b>E:nth-child(odd)</b> E is an odd child of its parent</li>
57 <li> <b>E:nth-child(even)</b> E is an even child of its parent</li>
58 <li> <b>E:only-child</b> E is the only child of its parent</li>
59 <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>
60 <li> <b>E:first</b> the first E in the resultset</li>
61 <li> <b>E:last</b> the last E in the resultset</li>
62 <li> <b>E:nth(<i>n</i>)</b> the <i>n</i>th E in the resultset (1 based)</li>
63 <li> <b>E:odd</b> shortcut for :nth-child(odd)</li>
64 <li> <b>E:even</b> shortcut for :nth-child(even)</li>
65 <li> <b>E:contains(foo)</b> E's innerHTML contains the substring "foo"</li>
66 <li> <b>E:nodeValue(foo)</b> E contains a textNode with a nodeValue that equals "foo"</li>
67 <li> <b>E:not(S)</b> an E element that does not match simple selector S</li>
68 <li> <b>E:has(S)</b> an E element that has a descendent that matches simple selector S</li>
69 <li> <b>E:next(S)</b> an E element whose next sibling matches simple selector S</li>
70 <li> <b>E:prev(S)</b> an E element whose previous sibling matches simple selector S</li>
71 <li> <b>E:any(S1|S2|S2)</b> an E element which matches any of the simple selectors S1, S2 or S3//\\</li>
73 <h4>CSS Value Selectors:</h4>
74 <ul class="list">
75 <li> <b>E{display=none}</b> css value "display" that equals "none"</li>
76 <li> <b>E{display^=none}</b> css value "display" that starts with "none"</li>
77 <li> <b>E{display$=none}</b> css value "display" that ends with "none"</li>
78 <li> <b>E{display*=none}</b> css value "display" that contains the substring "none"</li>
79 <li> <b>E{display%=2}</b> css value "display" that is evenly divisible by 2</li>
80 <li> <b>E{display!=none}</b> css value "display" that does not equal "none"</li>
86 Ext.core.DomQuery = Ext.DomQuery = function(){
91 trimRe = /^\s+|\s+$/g,
93 modeRe = /^(\s?[\/>+~]\s?|\s|$)/,
94 tagTokenRe = /^(#)?([\w-\*]+)/,
95 nthRe = /(\d*)n\+?(\d*)/,
97 // This is for IE MSXML which does not support expandos.
98 // IE runs the same speed using setAttribute, however FF slows way down
99 // and Safari completely fails so they need to continue to use expandos.
100 isIE = window.ActiveXObject ? true : false,
103 // this eval is stop the compressor from
104 // renaming the variable to something shorter
105 eval("var batch = 30803;");
107 // Retrieve the child node from a particular
108 // parent at the specified index.
109 function child(parent, index){
111 n = parent.firstChild;
123 // retrieve the next element node
125 while((n = n.nextSibling) && n.nodeType != 1);
129 // retrieve the previous element node
131 while((n = n.previousSibling) && n.nodeType != 1);
135 // Mark each child node with a nodeIndex skipping and
136 // removing empty text nodes.
137 function children(parent){
138 var n = parent.firstChild,
142 nextNode = n.nextSibling;
143 // clean worthless empty nodes.
144 if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
145 parent.removeChild(n);
147 // add an expando nodeIndex
148 n.nodeIndex = ++nodeIndex;
156 // nodeSet - array of nodes
158 function byClassName(nodeSet, cls){
162 var result = [], ri = -1;
163 for(var i = 0, ci; ci = nodeSet[i]; i++){
164 if((' '+ci.className+' ').indexOf(cls) != -1){
171 function attrValue(n, attr){
172 // if its an array, use the first node.
173 if(!n.tagName && typeof n.length != "undefined"){
180 if(attr == "for"){
183 if(attr == "class" || attr == "className"){
186 return n.getAttribute(attr) || n[attr];
192 // mode - false, /, >, +, ~
193 // tagName - defaults to "*"
194 function getNodes(ns, mode, tagName){
195 var result = [], ri = -1, cs;
199 tagName = tagName || "*";
201 if(typeof ns.getElementsByTagName != "undefined"){
205 // no mode specified, grab all elements by tagName
208 for(var i = 0, ni; ni = ns[i]; i++){
209 cs = ni.getElementsByTagName(tagName);
210 for(var j = 0, ci; ci = cs[j]; j++){
214 // Direct Child mode (/ or >)
215 // E > F or E/F all direct children elements of E that have the tag
216 } else if(mode == "/" || mode == ">"){
217 var utag = tagName.toUpperCase();
218 for(var i = 0, ni, cn; ni = ns[i]; i++){
220 for(var j = 0, cj; cj = cn[j]; j++){
221 if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){
226 // Immediately Preceding mode (+)
227 // E + F all elements with the tag F that are immediately preceded by an element with the tag E
228 }else if(mode == "+"){
229 var utag = tagName.toUpperCase();
230 for(var i = 0, n; n = ns[i]; i++){
231 while((n = n.nextSibling) && n.nodeType != 1);
232 if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
237 // E ~ F all elements with the tag F that are preceded by a sibling element with the tag E
238 }else if(mode == "~"){
239 var utag = tagName.toUpperCase();
240 for(var i = 0, n; n = ns[i]; i++){
241 while((n = n.nextSibling)){
242 if (n.nodeName == utag || n.nodeName == tagName || tagName == '*'){
251 function concat(a, b){
255 for(var i = 0, l = b.length; i < l; i++){
261 function byTag(cs, tagName){
262 if(cs.tagName || cs == document){
268 var result = [], ri = -1;
269 tagName = tagName.toLowerCase();
270 for(var i = 0, ci; ci = cs[i]; i++){
271 if(ci.nodeType == 1 && ci.tagName.toLowerCase() == tagName){
278 function byId(cs, id){
279 if(cs.tagName || cs == document){
285 var result = [], ri = -1;
286 for(var i = 0, ci; ci = cs[i]; i++){
287 if(ci && ci.id == id){
295 // operators are =, !=, ^=, $=, *=, %=, |= and ~=
296 // custom can be "{"
297 function byAttribute(cs, attr, value, op, custom){
300 useGetStyle = custom == "{",
301 fn = Ext.DomQuery.operators[op],
306 for(var i = 0, ci; ci = cs[i]; i++){
307 // skip non-element nodes.
308 if(ci.nodeType != 1){
311 // only need to do this for the first node
313 xml = Ext.DomQuery.isXml(ci);
317 // we only need to change the property names if we're dealing with html nodes, not XML
320 a = Ext.DomQuery.getStyle(ci, attr);
321 } else if (attr == "class" || attr == "className"){
323 } else if (attr == "for"){
325 } else if (attr == "href"){
326 // getAttribute href bug
327 // http://www.glennjones.net/Post/809/getAttributehrefbug.htm
328 a = ci.getAttribute("href", 2);
330 a = ci.getAttribute(attr);
333 a = ci.getAttribute(attr);
335 if((fn && fn(a, value)) || (!fn && a)){
342 function byPseudo(cs, name, value){
343 return Ext.DomQuery.pseudos[name](cs, value);
346 function nodupIEXml(cs){
349 cs[0].setAttribute("_nodup", d);
351 for(var i = 1, len = cs.length; i < len; i++){
353 if(!c.getAttribute("_nodup") != d){
354 c.setAttribute("_nodup", d);
358 for(var i = 0, len = cs.length; i < len; i++){
359 cs[i].removeAttribute("_nodup");
368 var len = cs.length, c, i, r = cs, cj, ri = -1;
369 if(!len || typeof cs.nodeType != "undefined" || len == 1){
372 if(isIE && typeof cs[0].selectSingleNode != "undefined"){
373 return nodupIEXml(cs);
377 for(i = 1; c = cs[i]; i++){
382 for(var j = 0; j < i; j++){
385 for(j = i+1; cj = cs[j]; j++){
397 function quickDiffIEXml(c1, c2){
400 for(var i = 0, len = c1.length; i < len; i++){
401 c1[i].setAttribute("_qdiff", d);
403 for(var i = 0, len = c2.length; i < len; i++){
404 if(c2[i].getAttribute("_qdiff") != d){
408 for(var i = 0, len = c1.length; i < len; i++){
409 c1[i].removeAttribute("_qdiff");
414 function quickDiff(c1, c2){
415 var len1 = c1.length,
421 if(isIE && typeof c1[0].selectSingleNode != "undefined"){
422 return quickDiffIEXml(c1, c2);
424 for(var i = 0; i < len1; i++){
427 for(var i = 0, len = c2.length; i < len; i++){
428 if(c2[i]._qdiff != d){
435 function quickId(ns, mode, root, id){
437 var d = root.ownerDocument || root;
438 return d.getElementById(id);
440 ns = getNodes(ns, mode, "*");
445 getStyle : function(el, name){
446 return Ext.fly(el).getStyle(name);
448 <span id='Ext-DomQuery-method-compile'> /**
449 </span> * Compiles a selector/xpath query into a reusable function. The returned function
450 * takes one parameter "root" (optional), which is the context node from where the query should start.
451 * @param {String} selector The selector/xpath query
452 * @param {String} type (optional) Either "select" (the default) or "simple" for a simple selector match
455 compile : function(path, type){
456 type = type || "select";
459 var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"],
462 matchers = Ext.DomQuery.matchers,
463 matchersLn = matchers.length,
465 // accept leading mode switch
466 lmode = path.match(modeRe);
468 if(lmode && lmode[1]){
469 fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
470 path = path.replace(lmode[1], "");
473 // strip leading slashes
474 while(path.substr(0, 1)=="/"){
475 path = path.substr(1);
478 while(path && lastPath != path){
480 var tokenMatch = path.match(tagTokenRe);
481 if(type == "select"){
484 if(tokenMatch[1] == "#"){
485 fn[fn.length] = 'n = quickId(n, mode, root, "'+tokenMatch[2]+'");';
487 fn[fn.length] = 'n = getNodes(n, mode, "'+tokenMatch[2]+'");';
489 path = path.replace(tokenMatch[0], "");
490 }else if(path.substr(0, 1) != '@'){
491 fn[fn.length] = 'n = getNodes(n, mode, "*");';
493 // type of "simple"
496 if(tokenMatch[1] == "#"){
497 fn[fn.length] = 'n = byId(n, "'+tokenMatch[2]+'");';
499 fn[fn.length] = 'n = byTag(n, "'+tokenMatch[2]+'");';
501 path = path.replace(tokenMatch[0], "");
504 while(!(modeMatch = path.match(modeRe))){
506 for(var j = 0; j < matchersLn; j++){
508 var m = path.match(t.re);
510 fn[fn.length] = t.select.replace(tplRe, function(x, i){
513 path = path.replace(m[0], "");
518 // prevent infinite loop on bad selector
522 sourceClass: 'Ext.DomQuery',
523 sourceMethod: 'compile',
524 msg: 'Error parsing selector. Parsing failed at "' + path + '"'
530 fn[fn.length] = 'mode="'+modeMatch[1].replace(trimRe, "")+'";';
531 path = path.replace(modeMatch[1], "");
535 fn[fn.length] = "return nodup(n);\n}";
537 // eval fn and return it
538 eval(fn.join(""));
542 <span id='Ext-DomQuery-method-jsSelect'> /**
543 </span> * Selects an array of DOM nodes using JavaScript-only implementation.
545 * Use {@link #select} to take advantage of browsers built-in support for CSS selectors.
547 * @param {String} selector The selector/xpath query (can be a comma separated list of selectors)
548 * @param {Node/String} root (optional) The start of the query (defaults to document).
549 * @return {Array} An Array of DOM elements which match the selector. If there are
550 * no matches, and empty Array is returned.
552 jsSelect: function(path, root, type){
553 // set root to doc if not specified.
554 root = root || document;
556 if(typeof root == "string"){
557 root = document.getElementById(root);
559 var paths = path.split(","),
562 // loop over each selector
563 for(var i = 0, len = paths.length; i < len; i++){
564 var subPath = paths[i].replace(trimRe, "");
565 // compile and place in cache
567 cache[subPath] = Ext.DomQuery.compile(subPath);
571 sourceClass: 'Ext.DomQuery',
572 sourceMethod: 'jsSelect',
573 msg: subPath + ' is not a valid selector'
578 var result = cache[subPath](root);
579 if(result && result != document){
580 results = results.concat(result);
584 // if there were multiple selectors, make sure dups
586 if(paths.length > 1){
587 return nodup(results);
592 isXml: function(el) {
593 var docEl = (el ? el.ownerDocument || el : 0).documentElement;
594 return docEl ? docEl.nodeName !== "HTML" : false;
597 <span id='Ext-DomQuery-method-select'> /**
598 </span> * Selects an array of DOM nodes by CSS/XPath selector.
600 * Uses [document.querySelectorAll][0] if browser supports that, otherwise falls back to
601 * {@link #jsSelect} to do the work.
603 * Aliased as {@link Ext#query}.
605 * [0]: https://developer.mozilla.org/en/DOM/document.querySelectorAll
607 * @param {String} path The selector/xpath query
608 * @param {Node} root (optional) The start of the query (defaults to document).
609 * @return {Array} An array of DOM elements (not a NodeList as returned by `querySelectorAll`).
610 * Empty array when no matches.
613 select : document.querySelectorAll ? function(path, root, type) {
614 root = root || document;
615 if (!Ext.DomQuery.isXml(root)) {
617 var cs = root.querySelectorAll(path);
618 return Ext.Array.toArray(cs);
622 return Ext.DomQuery.jsSelect.call(this, path, root, type);
623 } : function(path, root, type) {
624 return Ext.DomQuery.jsSelect.call(this, path, root, type);
627 <span id='Ext-DomQuery-method-selectNode'> /**
628 </span> * Selects a single element.
629 * @param {String} selector The selector/xpath query
630 * @param {Node} root (optional) The start of the query (defaults to document).
631 * @return {Element} The DOM element which matched the selector.
633 selectNode : function(path, root){
634 return Ext.DomQuery.select(path, root)[0];
637 <span id='Ext-DomQuery-method-selectValue'> /**
638 </span> * Selects the value of a node, optionally replacing null with the defaultValue.
639 * @param {String} selector The selector/xpath query
640 * @param {Node} root (optional) The start of the query (defaults to document).
641 * @param {String} defaultValue
644 selectValue : function(path, root, defaultValue){
645 path = path.replace(trimRe, "");
646 if(!valueCache[path]){
647 valueCache[path] = Ext.DomQuery.compile(path, "select");
649 var n = valueCache[path](root), v;
652 // overcome a limitation of maximum textnode size
653 // Rumored to potentially crash IE6 but has not been confirmed.
654 // http://reference.sitepoint.com/javascript/Node/normalize
655 // https://developer.mozilla.org/En/DOM/Node.normalize
656 if (typeof n.normalize == 'function') n.normalize();
658 v = (n && n.firstChild ? n.firstChild.nodeValue : null);
659 return ((v === null||v === undefined||v==='') ? defaultValue : v);
662 <span id='Ext-DomQuery-method-selectNumber'> /**
663 </span> * Selects the value of a node, parsing integers and floats. Returns the defaultValue, or 0 if none is specified.
664 * @param {String} selector The selector/xpath query
665 * @param {Node} root (optional) The start of the query (defaults to document).
666 * @param {Number} defaultValue
669 selectNumber : function(path, root, defaultValue){
670 var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
671 return parseFloat(v);
674 <span id='Ext-DomQuery-method-is'> /**
675 </span> * Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)
676 * @param {String/HTMLElement/Array} el An element id, element or array of elements
677 * @param {String} selector The simple selector to test
680 is : function(el, ss){
681 if(typeof el == "string"){
682 el = document.getElementById(el);
684 var isArray = Ext.isArray(el),
685 result = Ext.DomQuery.filter(isArray ? el : [el], ss);
686 return isArray ? (result.length == el.length) : (result.length > 0);
689 <span id='Ext-DomQuery-method-filter'> /**
690 </span> * Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)
691 * @param {Array} el An array of elements to filter
692 * @param {String} selector The simple selector to test
693 * @param {Boolean} nonMatches If true, it returns the elements that DON'T match
694 * the selector instead of the ones that match
695 * @return {Array} An Array of DOM elements which match the selector. If there are
696 * no matches, and empty Array is returned.
698 filter : function(els, ss, nonMatches){
699 ss = ss.replace(trimRe, "");
700 if(!simpleCache[ss]){
701 simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
703 var result = simpleCache[ss](els);
704 return nonMatches ? quickDiff(result, els) : result;
707 <span id='Ext-DomQuery-property-matchers'> /**
708 </span> * Collection of matching regular expressions and code snippets.
709 * Each capture group within () will be replace the {} in the select
710 * statement as specified by their index.
714 select: 'n = byClassName(n, " {1} ");'
716 re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
717 select: 'n = byPseudo(n, "{1}", "{2}");'
719 re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
720 select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
723 select: 'n = byId(n, "{1}");'
726 select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
730 <span id='Ext-DomQuery-property-operators'> /**
731 </span> * Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *=, %=, |= and ~=.
732 * 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, &gt; &lt;.
735 "=" : function(a, v){
738 "!=" : function(a, v){
741 "^=" : function(a, v){
742 return a && a.substr(0, v.length) == v;
744 "$=" : function(a, v){
745 return a && a.substr(a.length-v.length) == v;
747 "*=" : function(a, v){
748 return a && a.indexOf(v) !== -1;
750 "%=" : function(a, v){
753 "|=" : function(a, v){
754 return a && (a == v || a.substr(0, v.length+1) == v+'-');
756 "~=" : function(a, v){
757 return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
761 <span id='Ext-DomQuery-property-pseudos'> /**
762 </span>Object hash of "pseudo class" filter functions which are used when filtering selections.
763 Each function is passed two parameters:
766 An Array of DOM elements to filter.
769 The argument (if any) supplied in the selector.
771 A filter function returns an Array of DOM elements which conform to the pseudo class.
772 In addition to the provided pseudo classes listed above such as `first-child` and `nth-child`,
773 developers may add additional, custom psuedo class filters to select elements according to application-specific requirements.
775 For example, to filter `a` elements to only return links to __external__ resources:
777 Ext.DomQuery.pseudos.external = function(c, v){
779 for(var i = 0, ci; ci = c[i]; i++){
780 // Include in result set only if it's a link to an external resource
781 if(ci.hostname != location.hostname){
788 Then external links could be gathered with the following statement:
790 var externalLinks = Ext.select("a:external");
795 "first-child" : function(c){
796 var r = [], ri = -1, n;
797 for(var i = 0, ci; ci = n = c[i]; i++){
798 while((n = n.previousSibling) && n.nodeType != 1);
806 "last-child" : function(c){
807 var r = [], ri = -1, n;
808 for(var i = 0, ci; ci = n = c[i]; i++){
809 while((n = n.nextSibling) && n.nodeType != 1);
817 "nth-child" : function(c, a) {
819 m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a),
820 f = (m[1] || 1) - 0, l = m[2] - 0;
821 for(var i = 0, n; n = c[i]; i++){
822 var pn = n.parentNode;
823 if (batch != pn._batch) {
825 for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
826 if(cn.nodeType == 1){
833 if (l == 0 || n.nodeIndex == l){
836 } else if ((n.nodeIndex + l) % f == 0){
844 "only-child" : function(c){
845 var r = [], ri = -1;;
846 for(var i = 0, ci; ci = c[i]; i++){
847 if(!prev(ci) && !next(ci)){
854 "empty" : function(c){
856 for(var i = 0, ci; ci = c[i]; i++){
857 var cns = ci.childNodes, j = 0, cn, empty = true;
860 if(cn.nodeType == 1 || cn.nodeType == 3){
872 "contains" : function(c, v){
874 for(var i = 0, ci; ci = c[i]; i++){
875 if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
882 "nodeValue" : function(c, v){
884 for(var i = 0, ci; ci = c[i]; i++){
885 if(ci.firstChild && ci.firstChild.nodeValue == v){
892 "checked" : function(c){
894 for(var i = 0, ci; ci = c[i]; i++){
895 if(ci.checked == true){
902 "not" : function(c, ss){
903 return Ext.DomQuery.filter(c, ss, true);
906 "any" : function(c, selectors){
907 var ss = selectors.split('|'),
909 for(var i = 0, ci; ci = c[i]; i++){
910 for(var j = 0; s = ss[j]; j++){
911 if(Ext.DomQuery.is(ci, s)){
920 "odd" : function(c){
921 return this["nth-child"](c, "odd");
924 "even" : function(c){
925 return this["nth-child"](c, "even");
928 "nth" : function(c, a){
932 "first" : function(c){
936 "last" : function(c){
937 return c[c.length-1] || [];
940 "has" : function(c, ss){
941 var s = Ext.DomQuery.select,
943 for(var i = 0, ci; ci = c[i]; i++){
944 if(s(ss, ci).length > 0){
951 "next" : function(c, ss){
952 var is = Ext.DomQuery.is,
954 for(var i = 0, ci; ci = c[i]; i++){
956 if(n && is(n, ss)){
963 "prev" : function(c, ss){
964 var is = Ext.DomQuery.is,
966 for(var i = 0, ci; ci = c[i]; i++){
968 if(n && is(n, ss)){
978 <span id='Ext-method-query'>/**
979 </span> * Selects an array of DOM nodes by CSS/XPath selector. Shorthand of {@link Ext.DomQuery#select}
980 * @param {String} path The selector/xpath query
981 * @param {Node} root (optional) The start of the query (defaults to document).
986 Ext.query = Ext.DomQuery.select;