3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">/*
\r
9 * This is code is also distributed under MIT license for use
\r
10 * with jQuery and prototype JavaScript libraries.
\r
12 <div id="cls-Ext.DomQuery"></div>/**
\r
13 * @class Ext.DomQuery
\r
14 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
16 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
19 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
21 <h4>Element Selectors:</h4>
\r
23 <li> <b>*</b> any element</li>
\r
24 <li> <b>E</b> an element with the tag E</li>
\r
25 <li> <b>E F</b> All descendent elements of E that have the tag F</li>
\r
26 <li> <b>E > F</b> or <b>E/F</b> all direct children elements of E that have the tag F</li>
\r
27 <li> <b>E + F</b> all elements with the tag F that are immediately preceded by an element with the tag E</li>
\r
28 <li> <b>E ~ F</b> all elements with the tag F that are preceded by a sibling element with the tag E</li>
\r
30 <h4>Attribute Selectors:</h4>
\r
31 <p>The use of @ and quotes are optional. For example, div[@foo='bar'] is also a valid attribute selector.</p>
\r
33 <li> <b>E[foo]</b> has an attribute "foo"</li>
\r
34 <li> <b>E[foo=bar]</b> has an attribute "foo" that equals "bar"</li>
\r
35 <li> <b>E[foo^=bar]</b> has an attribute "foo" that starts with "bar"</li>
\r
36 <li> <b>E[foo$=bar]</b> has an attribute "foo" that ends with "bar"</li>
\r
37 <li> <b>E[foo*=bar]</b> has an attribute "foo" that contains the substring "bar"</li>
\r
38 <li> <b>E[foo%=2]</b> has an attribute "foo" that is evenly divisible by 2</li>
\r
39 <li> <b>E[foo!=bar]</b> has an attribute "foo" that does not equal "bar"</li>
\r
41 <h4>Pseudo Classes:</h4>
\r
43 <li> <b>E:first-child</b> E is the first child of its parent</li>
\r
44 <li> <b>E:last-child</b> E is the last child of its parent</li>
\r
45 <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
46 <li> <b>E:nth-child(odd)</b> E is an odd child of its parent</li>
\r
47 <li> <b>E:nth-child(even)</b> E is an even child of its parent</li>
\r
48 <li> <b>E:only-child</b> E is the only child of its parent</li>
\r
49 <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
50 <li> <b>E:first</b> the first E in the resultset</li>
\r
51 <li> <b>E:last</b> the last E in the resultset</li>
\r
52 <li> <b>E:nth(<i>n</i>)</b> the <i>n</i>th E in the resultset (1 based)</li>
\r
53 <li> <b>E:odd</b> shortcut for :nth-child(odd)</li>
\r
54 <li> <b>E:even</b> shortcut for :nth-child(even)</li>
\r
55 <li> <b>E:contains(foo)</b> E's innerHTML contains the substring "foo"</li>
\r
56 <li> <b>E:nodeValue(foo)</b> E contains a textNode with a nodeValue that equals "foo"</li>
\r
57 <li> <b>E:not(S)</b> an E element that does not match simple selector S</li>
\r
58 <li> <b>E:has(S)</b> an E element that has a descendent that matches simple selector S</li>
\r
59 <li> <b>E:next(S)</b> an E element whose next sibling matches simple selector S</li>
\r
60 <li> <b>E:prev(S)</b> an E element whose previous sibling matches simple selector S</li>
\r
62 <h4>CSS Value Selectors:</h4>
\r
64 <li> <b>E{display=none}</b> css value "display" that equals "none"</li>
\r
65 <li> <b>E{display^=none}</b> css value "display" that starts with "none"</li>
\r
66 <li> <b>E{display$=none}</b> css value "display" that ends with "none"</li>
\r
67 <li> <b>E{display*=none}</b> css value "display" that contains the substring "none"</li>
\r
68 <li> <b>E{display%=2}</b> css value "display" that is evenly divisible by 2</li>
\r
69 <li> <b>E{display!=none}</b> css value "display" that does not equal "none"</li>
\r
73 Ext.DomQuery = function(){
\r
78 trimRe = /^\s+|\s+$/g,
\r
79 tplRe = /\{(\d+)\}/g,
\r
80 modeRe = /^(\s?[\/>+~]\s?|\s|$)/,
\r
81 tagTokenRe = /^(#)?([\w-\*]+)/,
\r
82 nthRe = /(\d*)n\+?(\d*)/,
\r
84 // This is for IE MSXML which does not support expandos.
\r
85 // IE runs the same speed using setAttribute, however FF slows way down
\r
86 // and Safari completely fails so they need to continue to use expandos.
\r
87 isIE = window.ActiveXObject ? true : false,
\r
88 isOpera = Ext.isOpera,
\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 = isOpera ? ni.childNodes : (ni.children || 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 && c1[0].selectSingleNode){
\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),
\r
529 n = n[0] ? n[0] : n;
\r
530 v = (n && n.firstChild ? n.firstChild.nodeValue : null);
\r
531 return ((v === null||v === undefined||v==='') ? defaultValue : v);
\r
534 <div id="method-Ext.DomQuery-selectNumber"></div>/**
\r
535 * Selects the value of a node, parsing integers and floats. Returns the defaultValue, or 0 if none is specified.
\r
536 * @param {String} selector The selector/xpath query
\r
537 * @param {Node} root (optional) The start of the query (defaults to document).
\r
538 * @param {Number} defaultValue
\r
541 selectNumber : function(path, root, defaultValue){
\r
542 var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
\r
543 return parseFloat(v);
\r
546 <div id="method-Ext.DomQuery-is"></div>/**
\r
547 * Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)
\r
548 * @param {String/HTMLElement/Array} el An element id, element or array of elements
\r
549 * @param {String} selector The simple selector to test
\r
550 * @return {Boolean}
\r
552 is : function(el, ss){
\r
553 if(typeof el == "string"){
\r
554 el = document.getElementById(el);
\r
556 var isArray = Ext.isArray(el),
\r
557 result = Ext.DomQuery.filter(isArray ? el : [el], ss);
\r
558 return isArray ? (result.length == el.length) : (result.length > 0);
\r
561 <div id="method-Ext.DomQuery-filter"></div>/**
\r
562 * Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)
\r
563 * @param {Array} el An array of elements to filter
\r
564 * @param {String} selector The simple selector to test
\r
565 * @param {Boolean} nonMatches If true, it returns the elements that DON'T match
\r
566 * the selector instead of the ones that match
\r
567 * @return {Array} An Array of DOM elements which match the selector. If there are
\r
568 * no matches, and empty Array is returned.
\r
570 filter : function(els, ss, nonMatches){
\r
571 ss = ss.replace(trimRe, "");
\r
572 if(!simpleCache[ss]){
\r
573 simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
\r
575 var result = simpleCache[ss](els);
\r
576 return nonMatches ? quickDiff(result, els) : result;
\r
579 <div id="prop-Ext.DomQuery-matchers"></div>/**
\r
580 * Collection of matching regular expressions and code snippets.
\r
584 select: 'n = byClassName(n, null, " {1} ");'
\r
586 re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
\r
587 select: 'n = byPseudo(n, "{1}", "{2}");'
\r
589 re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
\r
590 select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
\r
593 select: 'n = byId(n, null, "{1}");'
\r
596 select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
\r
600 <div id="method-Ext.DomQuery-operators"></div>/**
\r
601 * Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *=, %=, |= and ~=.
\r
602 * 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
605 "=" : function(a, v){
\r
608 "!=" : function(a, v){
\r
611 "^=" : function(a, v){
\r
612 return a && a.substr(0, v.length) == v;
\r
614 "$=" : function(a, v){
\r
615 return a && a.substr(a.length-v.length) == v;
\r
617 "*=" : function(a, v){
\r
618 return a && a.indexOf(v) !== -1;
\r
620 "%=" : function(a, v){
\r
621 return (a % v) == 0;
\r
623 "|=" : function(a, v){
\r
624 return a && (a == v || a.substr(0, v.length+1) == v+'-');
\r
626 "~=" : function(a, v){
\r
627 return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
\r
631 <div id="prop-Ext.DomQuery-pseudos"></div>/**
\r
632 * Collection of "pseudo class" processors. Each processor is passed the current nodeset (array)
\r
633 * and the argument (if any) supplied in the selector.
\r
636 "first-child" : function(c){
\r
637 var r = [], ri = -1, n;
\r
638 for(var i = 0, ci; ci = n = c[i]; i++){
\r
639 while((n = n.previousSibling) && n.nodeType != 1);
\r
647 "last-child" : function(c){
\r
648 var r = [], ri = -1, n;
\r
649 for(var i = 0, ci; ci = n = c[i]; i++){
\r
650 while((n = n.nextSibling) && n.nodeType != 1);
\r
658 "nth-child" : function(c, a) {
\r
659 var r = [], ri = -1,
\r
660 m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a),
\r
661 f = (m[1] || 1) - 0, l = m[2] - 0;
\r
662 for(var i = 0, n; n = c[i]; i++){
\r
663 var pn = n.parentNode;
\r
664 if (batch != pn._batch) {
\r
666 for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
\r
667 if(cn.nodeType == 1){
\r
668 cn.nodeIndex = ++j;
\r
674 if (l == 0 || n.nodeIndex == l){
\r
677 } else if ((n.nodeIndex + l) % f == 0){
\r
685 "only-child" : function(c){
\r
686 var r = [], ri = -1;;
\r
687 for(var i = 0, ci; ci = c[i]; i++){
\r
688 if(!prev(ci) && !next(ci)){
\r
695 "empty" : function(c){
\r
696 var r = [], ri = -1;
\r
697 for(var i = 0, ci; ci = c[i]; i++){
\r
698 var cns = ci.childNodes, j = 0, cn, empty = true;
\r
699 while(cn = cns[j]){
\r
701 if(cn.nodeType == 1 || cn.nodeType == 3){
\r
713 "contains" : function(c, v){
\r
714 var r = [], ri = -1;
\r
715 for(var i = 0, ci; ci = c[i]; i++){
\r
716 if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
\r
723 "nodeValue" : function(c, v){
\r
724 var r = [], ri = -1;
\r
725 for(var i = 0, ci; ci = c[i]; i++){
\r
726 if(ci.firstChild && ci.firstChild.nodeValue == v){
\r
733 "checked" : function(c){
\r
734 var r = [], ri = -1;
\r
735 for(var i = 0, ci; ci = c[i]; i++){
\r
736 if(ci.checked == true){
\r
743 "not" : function(c, ss){
\r
744 return Ext.DomQuery.filter(c, ss, true);
\r
747 "any" : function(c, selectors){
\r
748 var ss = selectors.split('|'),
\r
749 r = [], ri = -1, s;
\r
750 for(var i = 0, ci; ci = c[i]; i++){
\r
751 for(var j = 0; s = ss[j]; j++){
\r
752 if(Ext.DomQuery.is(ci, s)){
\r
761 "odd" : function(c){
\r
762 return this["nth-child"](c, "odd");
\r
765 "even" : function(c){
\r
766 return this["nth-child"](c, "even");
\r
769 "nth" : function(c, a){
\r
770 return c[a-1] || [];
\r
773 "first" : function(c){
\r
777 "last" : function(c){
\r
778 return c[c.length-1] || [];
\r
781 "has" : function(c, ss){
\r
782 var s = Ext.DomQuery.select,
\r
784 for(var i = 0, ci; ci = c[i]; i++){
\r
785 if(s(ss, ci).length > 0){
\r
792 "next" : function(c, ss){
\r
793 var is = Ext.DomQuery.is,
\r
795 for(var i = 0, ci; ci = c[i]; i++){
\r
797 if(n && is(n, ss)){
\r
804 "prev" : function(c, ss){
\r
805 var is = Ext.DomQuery.is,
\r
807 for(var i = 0, ci; ci = c[i]; i++){
\r
809 if(n && is(n, ss)){
\r
819 <div id="method-Ext-query"></div>/**
\r
820 * Selects an array of DOM nodes by CSS/XPath selector. Shorthand of {@link Ext.DomQuery#select}
\r
821 * @param {String} path The selector/xpath query
\r
822 * @param {Node} root (optional) The start of the query (defaults to document).
\r
827 Ext.query = Ext.DomQuery.select;
\r