4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/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*)/,
98 // This is for IE MSXML which does not support expandos.
99 // IE runs the same speed using setAttribute, however FF slows way down
100 // and Safari completely fails so they need to continue to use expandos.
101 isIE = window.ActiveXObject ? true : false,
104 // this eval is stop the compressor from
105 // renaming the variable to something shorter
106 eval("var batch = 30803;");
108 // Retrieve the child node from a particular
109 // parent at the specified index.
110 function child(parent, index){
112 n = parent.firstChild;
124 // retrieve the next element node
126 while((n = n.nextSibling) && n.nodeType != 1);
130 // retrieve the previous element node
132 while((n = n.previousSibling) && n.nodeType != 1);
136 // Mark each child node with a nodeIndex skipping and
137 // removing empty text nodes.
138 function children(parent){
139 var n = parent.firstChild,
143 nextNode = n.nextSibling;
144 // clean worthless empty nodes.
145 if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
146 parent.removeChild(n);
148 // add an expando nodeIndex
149 n.nodeIndex = ++nodeIndex;
157 // nodeSet - array of nodes
159 function byClassName(nodeSet, cls){
163 var result = [], ri = -1;
164 for(var i = 0, ci; ci = nodeSet[i]; i++){
165 if((' '+ci.className+' ').indexOf(cls) != -1){
172 function attrValue(n, attr){
173 // if its an array, use the first node.
174 if(!n.tagName && typeof n.length != "undefined"){
181 if(attr == "for"){
184 if(attr == "class" || attr == "className"){
187 return n.getAttribute(attr) || n[attr];
193 // mode - false, /, >, +, ~
194 // tagName - defaults to "*"
195 function getNodes(ns, mode, tagName){
196 var result = [], ri = -1, cs;
200 tagName = tagName || "*";
202 if(typeof ns.getElementsByTagName != "undefined"){
206 // no mode specified, grab all elements by tagName
209 for(var i = 0, ni; ni = ns[i]; i++){
210 cs = ni.getElementsByTagName(tagName);
211 for(var j = 0, ci; ci = cs[j]; j++){
215 // Direct Child mode (/ or >)
216 // E > F or E/F all direct children elements of E that have the tag
217 } else if(mode == "/" || mode == ">"){
218 var utag = tagName.toUpperCase();
219 for(var i = 0, ni, cn; ni = ns[i]; i++){
221 for(var j = 0, cj; cj = cn[j]; j++){
222 if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){
227 // Immediately Preceding mode (+)
228 // E + F all elements with the tag F that are immediately preceded by an element with the tag E
229 }else if(mode == "+"){
230 var utag = tagName.toUpperCase();
231 for(var i = 0, n; n = ns[i]; i++){
232 while((n = n.nextSibling) && n.nodeType != 1);
233 if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
238 // E ~ F all elements with the tag F that are preceded by a sibling element with the tag E
239 }else if(mode == "~"){
240 var utag = tagName.toUpperCase();
241 for(var i = 0, n; n = ns[i]; i++){
242 while((n = n.nextSibling)){
243 if (n.nodeName == utag || n.nodeName == tagName || tagName == '*'){
252 function concat(a, b){
256 for(var i = 0, l = b.length; i < l; i++){
262 function byTag(cs, tagName){
263 if(cs.tagName || cs == document){
269 var result = [], ri = -1;
270 tagName = tagName.toLowerCase();
271 for(var i = 0, ci; ci = cs[i]; i++){
272 if(ci.nodeType == 1 && ci.tagName.toLowerCase() == tagName){
279 function byId(cs, id){
280 if(cs.tagName || cs == document){
286 var result = [], ri = -1;
287 for(var i = 0, ci; ci = cs[i]; i++){
288 if(ci && ci.id == id){
296 // operators are =, !=, ^=, $=, *=, %=, |= and ~=
297 // custom can be "{"
298 function byAttribute(cs, attr, value, op, custom){
301 useGetStyle = custom == "{",
302 fn = Ext.DomQuery.operators[op],
307 for(var i = 0, ci; ci = cs[i]; i++){
308 // skip non-element nodes.
309 if(ci.nodeType != 1){
312 // only need to do this for the first node
314 xml = Ext.DomQuery.isXml(ci);
318 // we only need to change the property names if we're dealing with html nodes, not XML
321 a = Ext.DomQuery.getStyle(ci, attr);
322 } else if (attr == "class" || attr == "className"){
324 } else if (attr == "for"){
326 } else if (attr == "href"){
327 // getAttribute href bug
328 // http://www.glennjones.net/Post/809/getAttributehrefbug.htm
329 a = ci.getAttribute("href", 2);
331 a = ci.getAttribute(attr);
334 a = ci.getAttribute(attr);
336 if((fn && fn(a, value)) || (!fn && a)){
343 function byPseudo(cs, name, value){
344 return Ext.DomQuery.pseudos[name](cs, value);
347 function nodupIEXml(cs){
350 cs[0].setAttribute("_nodup", d);
352 for(var i = 1, len = cs.length; i < len; i++){
354 if(!c.getAttribute("_nodup") != d){
355 c.setAttribute("_nodup", d);
359 for(var i = 0, len = cs.length; i < len; i++){
360 cs[i].removeAttribute("_nodup");
369 var len = cs.length, c, i, r = cs, cj, ri = -1;
370 if(!len || typeof cs.nodeType != "undefined" || len == 1){
373 if(isIE && typeof cs[0].selectSingleNode != "undefined"){
374 return nodupIEXml(cs);
378 for(i = 1; c = cs[i]; i++){
383 for(var j = 0; j < i; j++){
386 for(j = i+1; cj = cs[j]; j++){
398 function quickDiffIEXml(c1, c2){
401 for(var i = 0, len = c1.length; i < len; i++){
402 c1[i].setAttribute("_qdiff", d);
404 for(var i = 0, len = c2.length; i < len; i++){
405 if(c2[i].getAttribute("_qdiff") != d){
409 for(var i = 0, len = c1.length; i < len; i++){
410 c1[i].removeAttribute("_qdiff");
415 function quickDiff(c1, c2){
416 var len1 = c1.length,
422 if(isIE && typeof c1[0].selectSingleNode != "undefined"){
423 return quickDiffIEXml(c1, c2);
425 for(var i = 0; i < len1; i++){
428 for(var i = 0, len = c2.length; i < len; i++){
429 if(c2[i]._qdiff != d){
436 function quickId(ns, mode, root, id){
438 var d = root.ownerDocument || root;
439 return d.getElementById(id);
441 ns = getNodes(ns, mode, "*");
446 getStyle : function(el, name){
447 return Ext.fly(el).getStyle(name);
449 <span id='Ext-DomQuery-method-compile'> /**
450 </span> * Compiles a selector/xpath query into a reusable function. The returned function
451 * takes one parameter "root" (optional), which is the context node from where the query should start.
452 * @param {String} selector The selector/xpath query
453 * @param {String} type (optional) Either "select" (the default) or "simple" for a simple selector match
456 compile : function(path, type){
457 type = type || "select";
460 var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"],
463 matchers = Ext.DomQuery.matchers,
464 matchersLn = matchers.length,
466 // accept leading mode switch
467 lmode = path.match(modeRe);
469 if(lmode && lmode[1]){
470 fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
471 path = path.replace(lmode[1], "");
474 // strip leading slashes
475 while(path.substr(0, 1)=="/"){
476 path = path.substr(1);
479 while(path && lastPath != path){
481 var tokenMatch = path.match(tagTokenRe);
482 if(type == "select"){
485 if(tokenMatch[1] == "#"){
486 fn[fn.length] = 'n = quickId(n, mode, root, "'+tokenMatch[2]+'");';
488 fn[fn.length] = 'n = getNodes(n, mode, "'+tokenMatch[2]+'");';
490 path = path.replace(tokenMatch[0], "");
491 }else if(path.substr(0, 1) != '@'){
492 fn[fn.length] = 'n = getNodes(n, mode, "*");';
494 // type of "simple"
497 if(tokenMatch[1] == "#"){
498 fn[fn.length] = 'n = byId(n, "'+tokenMatch[2]+'");';
500 fn[fn.length] = 'n = byTag(n, "'+tokenMatch[2]+'");';
502 path = path.replace(tokenMatch[0], "");
505 while(!(modeMatch = path.match(modeRe))){
507 for(var j = 0; j < matchersLn; j++){
509 var m = path.match(t.re);
511 fn[fn.length] = t.select.replace(tplRe, function(x, i){
514 path = path.replace(m[0], "");
519 // prevent infinite loop on bad selector
523 sourceClass: 'Ext.DomQuery',
524 sourceMethod: 'compile',
525 msg: 'Error parsing selector. Parsing failed at "' + path + '"'
531 fn[fn.length] = 'mode="'+modeMatch[1].replace(trimRe, "")+'";';
532 path = path.replace(modeMatch[1], "");
536 fn[fn.length] = "return nodup(n);\n}";
538 // eval fn and return it
539 eval(fn.join(""));
543 <span id='Ext-DomQuery-method-jsSelect'> /**
544 </span> * Selects an array of DOM nodes using JavaScript-only implementation.
546 * Use {@link #select} to take advantage of browsers built-in support for CSS selectors.
548 * @param {String} selector The selector/xpath query (can be a comma separated list of selectors)
549 * @param {HTMLElement/String} root (optional) The start of the query (defaults to document).
550 * @return {HTMLElement[]} An Array of DOM elements which match the selector. If there are
551 * no matches, and empty Array is returned.
553 jsSelect: function(path, root, type){
554 // set root to doc if not specified.
555 root = root || document;
557 if(typeof root == "string"){
558 root = document.getElementById(root);
560 var paths = path.split(","),
563 // loop over each selector
564 for(var i = 0, len = paths.length; i < len; i++){
565 var subPath = paths[i].replace(trimRe, "");
566 // compile and place in cache
568 cache[subPath] = Ext.DomQuery.compile(subPath);
572 sourceClass: 'Ext.DomQuery',
573 sourceMethod: 'jsSelect',
574 msg: subPath + ' is not a valid selector'
579 var result = cache[subPath](root);
580 if(result && result != document){
581 results = results.concat(result);
585 // if there were multiple selectors, make sure dups
587 if(paths.length > 1){
588 return nodup(results);
593 isXml: function(el) {
594 var docEl = (el ? el.ownerDocument || el : 0).documentElement;
595 return docEl ? docEl.nodeName !== "HTML" : false;
598 <span id='Ext-DomQuery-method-select'> /**
599 </span> * Selects an array of DOM nodes by CSS/XPath selector.
601 * Uses [document.querySelectorAll][0] if browser supports that, otherwise falls back to
602 * {@link Ext.DomQuery#jsSelect} to do the work.
604 * Aliased as {@link Ext#query}.
606 * [0]: https://developer.mozilla.org/en/DOM/document.querySelectorAll
608 * @param {String} path The selector/xpath query
609 * @param {HTMLElement} root (optional) The start of the query (defaults to document).
610 * @return {HTMLElement[]} An array of DOM elements (not a NodeList as returned by `querySelectorAll`).
611 * Empty array when no matches.
614 select : document.querySelectorAll ? function(path, root, type) {
615 root = root || document;
617 * Safari 3.x can't handle uppercase or unicode characters when in quirks mode.
619 if (!Ext.DomQuery.isXml(root) && !(Ext.isSafari3 && !Ext.isStrict)) {
622 * This checking here is to "fix" the behaviour of querySelectorAll
623 * for non root document queries. The way qsa works is intentional,
624 * however it's definitely not the expected way it should work.
625 * More info: http://ejohn.org/blog/thoughts-on-queryselectorall/
627 * We only modify the path for single selectors (ie, no multiples),
628 * without a full parser it makes it difficult to do this correctly.
630 var isDocumentRoot = root.nodeType === 9,
634 if (!isDocumentRoot && path.indexOf(',') === -1 && !startIdRe.test(path)) {
635 _path = '#' + Ext.id(root) + ' ' + path;
636 _root = root.parentNode;
638 return Ext.Array.toArray(_root.querySelectorAll(_path));
643 return Ext.DomQuery.jsSelect.call(this, path, root, type);
644 } : function(path, root, type) {
645 return Ext.DomQuery.jsSelect.call(this, path, root, type);
648 <span id='Ext-DomQuery-method-selectNode'> /**
649 </span> * Selects a single element.
650 * @param {String} selector The selector/xpath query
651 * @param {HTMLElement} root (optional) The start of the query (defaults to document).
652 * @return {HTMLElement} The DOM element which matched the selector.
654 selectNode : function(path, root){
655 return Ext.DomQuery.select(path, root)[0];
658 <span id='Ext-DomQuery-method-selectValue'> /**
659 </span> * Selects the value of a node, optionally replacing null with the defaultValue.
660 * @param {String} selector The selector/xpath query
661 * @param {HTMLElement} root (optional) The start of the query (defaults to document).
662 * @param {String} defaultValue (optional) When specified, this is return as empty value.
665 selectValue : function(path, root, defaultValue){
666 path = path.replace(trimRe, "");
667 if(!valueCache[path]){
668 valueCache[path] = Ext.DomQuery.compile(path, "select");
670 var n = valueCache[path](root), v;
673 // overcome a limitation of maximum textnode size
674 // Rumored to potentially crash IE6 but has not been confirmed.
675 // http://reference.sitepoint.com/javascript/Node/normalize
676 // https://developer.mozilla.org/En/DOM/Node.normalize
677 if (typeof n.normalize == 'function') n.normalize();
679 v = (n && n.firstChild ? n.firstChild.nodeValue : null);
680 return ((v === null||v === undefined||v==='') ? defaultValue : v);
683 <span id='Ext-DomQuery-method-selectNumber'> /**
684 </span> * Selects the value of a node, parsing integers and floats. Returns the defaultValue, or 0 if none is specified.
685 * @param {String} selector The selector/xpath query
686 * @param {HTMLElement} root (optional) The start of the query (defaults to document).
687 * @param {Number} defaultValue (optional) When specified, this is return as empty value.
690 selectNumber : function(path, root, defaultValue){
691 var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
692 return parseFloat(v);
695 <span id='Ext-DomQuery-method-is'> /**
696 </span> * Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)
697 * @param {String/HTMLElement/HTMLElement[]} el An element id, element or array of elements
698 * @param {String} selector The simple selector to test
701 is : function(el, ss){
702 if(typeof el == "string"){
703 el = document.getElementById(el);
705 var isArray = Ext.isArray(el),
706 result = Ext.DomQuery.filter(isArray ? el : [el], ss);
707 return isArray ? (result.length == el.length) : (result.length > 0);
710 <span id='Ext-DomQuery-method-filter'> /**
711 </span> * Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)
712 * @param {HTMLElement[]} el An array of elements to filter
713 * @param {String} selector The simple selector to test
714 * @param {Boolean} nonMatches If true, it returns the elements that DON'T match
715 * the selector instead of the ones that match
716 * @return {HTMLElement[]} An Array of DOM elements which match the selector. If there are
717 * no matches, and empty Array is returned.
719 filter : function(els, ss, nonMatches){
720 ss = ss.replace(trimRe, "");
721 if(!simpleCache[ss]){
722 simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
724 var result = simpleCache[ss](els);
725 return nonMatches ? quickDiff(result, els) : result;
728 <span id='Ext-DomQuery-property-matchers'> /**
729 </span> * Collection of matching regular expressions and code snippets.
730 * Each capture group within () will be replace the {} in the select
731 * statement as specified by their index.
735 select: 'n = byClassName(n, " {1} ");'
737 re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
738 select: 'n = byPseudo(n, "{1}", "{2}");'
740 re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
741 select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
744 select: 'n = byId(n, "{1}");'
747 select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
751 <span id='Ext-DomQuery-property-operators'> /**
752 </span> * Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *=, %=, |= and ~=.
753 * 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;.
756 "=" : function(a, v){
759 "!=" : function(a, v){
762 "^=" : function(a, v){
763 return a && a.substr(0, v.length) == v;
765 "$=" : function(a, v){
766 return a && a.substr(a.length-v.length) == v;
768 "*=" : function(a, v){
769 return a && a.indexOf(v) !== -1;
771 "%=" : function(a, v){
774 "|=" : function(a, v){
775 return a && (a == v || a.substr(0, v.length+1) == v+'-');
777 "~=" : function(a, v){
778 return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
782 <span id='Ext-DomQuery-property-pseudos'> /**
783 </span>Object hash of "pseudo class" filter functions which are used when filtering selections.
784 Each function is passed two parameters:
787 An Array of DOM elements to filter.
790 The argument (if any) supplied in the selector.
792 A filter function returns an Array of DOM elements which conform to the pseudo class.
793 In addition to the provided pseudo classes listed above such as `first-child` and `nth-child`,
794 developers may add additional, custom psuedo class filters to select elements according to application-specific requirements.
796 For example, to filter `a` elements to only return links to __external__ resources:
798 Ext.DomQuery.pseudos.external = function(c, v){
800 for(var i = 0, ci; ci = c[i]; i++){
801 // Include in result set only if it's a link to an external resource
802 if(ci.hostname != location.hostname){
809 Then external links could be gathered with the following statement:
811 var externalLinks = Ext.select("a:external");
816 "first-child" : function(c){
817 var r = [], ri = -1, n;
818 for(var i = 0, ci; ci = n = c[i]; i++){
819 while((n = n.previousSibling) && n.nodeType != 1);
827 "last-child" : function(c){
828 var r = [], ri = -1, n;
829 for(var i = 0, ci; ci = n = c[i]; i++){
830 while((n = n.nextSibling) && n.nodeType != 1);
838 "nth-child" : function(c, a) {
840 m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a),
841 f = (m[1] || 1) - 0, l = m[2] - 0;
842 for(var i = 0, n; n = c[i]; i++){
843 var pn = n.parentNode;
844 if (batch != pn._batch) {
846 for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
847 if(cn.nodeType == 1){
854 if (l == 0 || n.nodeIndex == l){
857 } else if ((n.nodeIndex + l) % f == 0){
865 "only-child" : function(c){
866 var r = [], ri = -1;;
867 for(var i = 0, ci; ci = c[i]; i++){
868 if(!prev(ci) && !next(ci)){
875 "empty" : function(c){
877 for(var i = 0, ci; ci = c[i]; i++){
878 var cns = ci.childNodes, j = 0, cn, empty = true;
881 if(cn.nodeType == 1 || cn.nodeType == 3){
893 "contains" : function(c, v){
895 for(var i = 0, ci; ci = c[i]; i++){
896 if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
903 "nodeValue" : function(c, v){
905 for(var i = 0, ci; ci = c[i]; i++){
906 if(ci.firstChild && ci.firstChild.nodeValue == v){
913 "checked" : function(c){
915 for(var i = 0, ci; ci = c[i]; i++){
916 if(ci.checked == true){
923 "not" : function(c, ss){
924 return Ext.DomQuery.filter(c, ss, true);
927 "any" : function(c, selectors){
928 var ss = selectors.split('|'),
930 for(var i = 0, ci; ci = c[i]; i++){
931 for(var j = 0; s = ss[j]; j++){
932 if(Ext.DomQuery.is(ci, s)){
941 "odd" : function(c){
942 return this["nth-child"](c, "odd");
945 "even" : function(c){
946 return this["nth-child"](c, "even");
949 "nth" : function(c, a){
953 "first" : function(c){
957 "last" : function(c){
958 return c[c.length-1] || [];
961 "has" : function(c, ss){
962 var s = Ext.DomQuery.select,
964 for(var i = 0, ci; ci = c[i]; i++){
965 if(s(ss, ci).length > 0){
972 "next" : function(c, ss){
973 var is = Ext.DomQuery.is,
975 for(var i = 0, ci; ci = c[i]; i++){
977 if(n && is(n, ss)){
984 "prev" : function(c, ss){
985 var is = Ext.DomQuery.is,
987 for(var i = 0, ci; ci = c[i]; i++){
989 if(n && is(n, ss)){
999 <span id='Ext-method-query'>/**
1000 </span> * Shorthand of {@link Ext.DomQuery#select}
1003 * @alias Ext.DomQuery#select
1005 Ext.query = Ext.DomQuery.select;