Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / docs / source / DomQuery.html
index 01fe025..ae27f15 100644 (file)
-<html>\r
-<head>\r
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    \r
-  <title>The source code</title>\r
-    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
-    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body  onload="prettyPrint();">\r
-    <pre class="prettyprint lang-js">/*\r
- * This is code is also distributed under MIT license for use\r
- * with jQuery and prototype JavaScript libraries.\r
- */\r
-<div id="cls-Ext.DomQuery"></div>/**\r
- * @class Ext.DomQuery\r
-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
-<p>\r
-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
-\r
-<p>\r
-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
-</p>\r
-<h4>Element Selectors:</h4>\r
-<ul class="list">\r
-    <li> <b>*</b> any element</li>\r
-    <li> <b>E</b> an element with the tag E</li>\r
-    <li> <b>E F</b> All descendent elements of E that have the tag F</li>\r
-    <li> <b>E > F</b> or <b>E/F</b> all direct children elements of E that have the tag F</li>\r
-    <li> <b>E + F</b> all elements with the tag F that are immediately preceded by an element with the tag E</li>\r
-    <li> <b>E ~ F</b> all elements with the tag F that are preceded by a sibling element with the tag E</li>\r
-</ul>\r
-<h4>Attribute Selectors:</h4>\r
-<p>The use of &#64; and quotes are optional. For example, div[&#64;foo='bar'] is also a valid attribute selector.</p>\r
-<ul class="list">\r
-    <li> <b>E[foo]</b> has an attribute "foo"</li>\r
-    <li> <b>E[foo=bar]</b> has an attribute "foo" that equals "bar"</li>\r
-    <li> <b>E[foo^=bar]</b> has an attribute "foo" that starts with "bar"</li>\r
-    <li> <b>E[foo$=bar]</b> has an attribute "foo" that ends with "bar"</li>\r
-    <li> <b>E[foo*=bar]</b> has an attribute "foo" that contains the substring "bar"</li>\r
-    <li> <b>E[foo%=2]</b> has an attribute "foo" that is evenly divisible by 2</li>\r
-    <li> <b>E[foo!=bar]</b> has an attribute "foo" that does not equal "bar"</li>\r
-</ul>\r
-<h4>Pseudo Classes:</h4>\r
-<ul class="list">\r
-    <li> <b>E:first-child</b> E is the first child of its parent</li>\r
-    <li> <b>E:last-child</b> E is the last child of its parent</li>\r
-    <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
-    <li> <b>E:nth-child(odd)</b> E is an odd child of its parent</li>\r
-    <li> <b>E:nth-child(even)</b> E is an even child of its parent</li>\r
-    <li> <b>E:only-child</b> E is the only child of its parent</li>\r
-    <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
-    <li> <b>E:first</b> the first E in the resultset</li>\r
-    <li> <b>E:last</b> the last E in the resultset</li>\r
-    <li> <b>E:nth(<i>n</i>)</b> the <i>n</i>th E in the resultset (1 based)</li>\r
-    <li> <b>E:odd</b> shortcut for :nth-child(odd)</li>\r
-    <li> <b>E:even</b> shortcut for :nth-child(even)</li>\r
-    <li> <b>E:contains(foo)</b> E's innerHTML contains the substring "foo"</li>\r
-    <li> <b>E:nodeValue(foo)</b> E contains a textNode with a nodeValue that equals "foo"</li>\r
-    <li> <b>E:not(S)</b> an E element that does not match simple selector S</li>\r
-    <li> <b>E:has(S)</b> an E element that has a descendent that matches simple selector S</li>\r
-    <li> <b>E:next(S)</b> an E element whose next sibling matches simple selector S</li>\r
-    <li> <b>E:prev(S)</b> an E element whose previous sibling matches simple selector S</li>\r
-    <li> <b>E:any(S1|S2|S2)</b> an E element which matches any of the simple selectors S1, S2 or S3//\\</li>\r
-</ul>\r
-<h4>CSS Value Selectors:</h4>\r
-<ul class="list">\r
-    <li> <b>E{display=none}</b> css value "display" that equals "none"</li>\r
-    <li> <b>E{display^=none}</b> css value "display" that starts with "none"</li>\r
-    <li> <b>E{display$=none}</b> css value "display" that ends with "none"</li>\r
-    <li> <b>E{display*=none}</b> css value "display" that contains the substring "none"</li>\r
-    <li> <b>E{display%=2}</b> css value "display" that is evenly divisible by 2</li>\r
-    <li> <b>E{display!=none}</b> css value "display" that does not equal "none"</li>\r
-</ul>\r
- * @singleton\r
- */\r
-Ext.DomQuery = function(){\r
-    var cache = {}, \r
-       simpleCache = {}, \r
-       valueCache = {},\r
-       nonSpace = /\S/,\r
-       trimRe = /^\s+|\s+$/g,\r
-       tplRe = /\{(\d+)\}/g,\r
-       modeRe = /^(\s?[\/>+~]\s?|\s|$)/,\r
-       tagTokenRe = /^(#)?([\w-\*]+)/,\r
-       nthRe = /(\d*)n\+?(\d*)/, \r
-       nthRe2 = /\D/,\r
-       // This is for IE MSXML which does not support expandos.\r
-       // IE runs the same speed using setAttribute, however FF slows way down\r
-       // and Safari completely fails so they need to continue to use expandos.\r
-       isIE = window.ActiveXObject ? true : false,\r
-       key = 30803;\r
-    \r
-    // this eval is stop the compressor from\r
-    // renaming the variable to something shorter\r
-    eval("var batch = 30803;");        \r
-\r
-    // Retrieve the child node from a particular\r
-    // parent at the specified index.\r
-    function child(parent, index){\r
-        var i = 0,\r
-            n = parent.firstChild;\r
-        while(n){\r
-            if(n.nodeType == 1){\r
-               if(++i == index){\r
-                   return n;\r
-               }\r
-            }\r
-            n = n.nextSibling;\r
-        }\r
-        return null;\r
-    }\r
-\r
-    // retrieve the next element node\r
-    function next(n){  \r
-        while((n = n.nextSibling) && n.nodeType != 1);\r
-        return n;\r
-    }\r
-\r
-    // retrieve the previous element node \r
-    function prev(n){\r
-        while((n = n.previousSibling) && n.nodeType != 1);\r
-        return n;\r
-    }\r
-\r
-    // Mark each child node with a nodeIndex skipping and\r
-    // removing empty text nodes.\r
-    function children(parent){\r
-        var n = parent.firstChild,\r
-           nodeIndex = -1,\r
-           nextNode;\r
-       while(n){\r
-           nextNode = n.nextSibling;\r
-           // clean worthless empty nodes.\r
-           if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){\r
-               parent.removeChild(n);\r
-           }else{\r
-               // add an expando nodeIndex\r
-               n.nodeIndex = ++nodeIndex;\r
-           }\r
-           n = nextNode;\r
-       }\r
-       return this;\r
-    }\r
-\r
-\r
-    // nodeSet - array of nodes\r
-    // cls - CSS Class\r
-    function byClassName(nodeSet, cls){\r
-        if(!cls){\r
-            return nodeSet;\r
-        }\r
-        var result = [], ri = -1;\r
-        for(var i = 0, ci; ci = nodeSet[i]; i++){\r
-            if((' '+ci.className+' ').indexOf(cls) != -1){\r
-                result[++ri] = ci;\r
-            }\r
-        }\r
-        return result;\r
-    };\r
-\r
-    function attrValue(n, attr){\r
-       // if its an array, use the first node.\r
-        if(!n.tagName && typeof n.length != "undefined"){\r
-            n = n[0];\r
-        }\r
-        if(!n){\r
-            return null;\r
-        }\r
-\r
-        if(attr == "for"){\r
-            return n.htmlFor;\r
-        }\r
-        if(attr == "class" || attr == "className"){\r
-            return n.className;\r
-        }\r
-        return n.getAttribute(attr) || n[attr];\r
-\r
-    };\r
-\r
-\r
-    // ns - nodes\r
-    // mode - false, /, >, +, ~\r
-    // tagName - defaults to "*"\r
-    function getNodes(ns, mode, tagName){\r
-        var result = [], ri = -1, cs;\r
-        if(!ns){\r
-            return result;\r
-        }\r
-        tagName = tagName || "*";\r
-       // convert to array\r
-        if(typeof ns.getElementsByTagName != "undefined"){\r
-            ns = [ns];\r
-        }\r
-       \r
-       // no mode specified, grab all elements by tagName\r
-       // at any depth\r
-        if(!mode){\r
-            for(var i = 0, ni; ni = ns[i]; i++){\r
-                cs = ni.getElementsByTagName(tagName);\r
-                for(var j = 0, ci; ci = cs[j]; j++){\r
-                    result[++ri] = ci;\r
-                }\r
-            }\r
-       // Direct Child mode (/ or >)\r
-       // E > F or E/F all direct children elements of E that have the tag     \r
-        } else if(mode == "/" || mode == ">"){\r
-            var utag = tagName.toUpperCase();\r
-            for(var i = 0, ni, cn; ni = ns[i]; i++){\r
-                cn = ni.childNodes;\r
-                for(var j = 0, cj; cj = cn[j]; j++){\r
-                    if(cj.nodeName == utag || cj.nodeName == tagName  || tagName == '*'){\r
-                        result[++ri] = cj;\r
-                    }\r
-                }\r
-            }\r
-       // Immediately Preceding mode (+)\r
-       // E + F all elements with the tag F that are immediately preceded by an element with the tag E\r
-        }else if(mode == "+"){\r
-            var utag = tagName.toUpperCase();\r
-            for(var i = 0, n; n = ns[i]; i++){\r
-                while((n = n.nextSibling) && n.nodeType != 1);\r
-                if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){\r
-                    result[++ri] = n;\r
-                }\r
-            }\r
-       // Sibling mode (~)\r
-       // E ~ F all elements with the tag F that are preceded by a sibling element with the tag E\r
-        }else if(mode == "~"){\r
-            var utag = tagName.toUpperCase();\r
-            for(var i = 0, n; n = ns[i]; i++){\r
-                while((n = n.nextSibling)){\r
-                    if (n.nodeName == utag || n.nodeName == tagName || tagName == '*'){\r
-                        result[++ri] = n;\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        return result;\r
-    }\r
-\r
-    function concat(a, b){\r
-        if(b.slice){\r
-            return a.concat(b);\r
-        }\r
-        for(var i = 0, l = b.length; i < l; i++){\r
-            a[a.length] = b[i];\r
-        }\r
-        return a;\r
-    }\r
-\r
-    function byTag(cs, tagName){\r
-        if(cs.tagName || cs == document){\r
-            cs = [cs];\r
-        }\r
-        if(!tagName){\r
-            return cs;\r
-        }\r
-        var result = [], ri = -1;\r
-        tagName = tagName.toLowerCase();\r
-        for(var i = 0, ci; ci = cs[i]; i++){\r
-            if(ci.nodeType == 1 && ci.tagName.toLowerCase() == tagName){\r
-                result[++ri] = ci;\r
-            }\r
-        }\r
-        return result;\r
-    }\r
-\r
-    function byId(cs, id){\r
-        if(cs.tagName || cs == document){\r
-            cs = [cs];\r
-        }\r
-        if(!id){\r
-            return cs;\r
-        }\r
-        var result = [], ri = -1;\r
-        for(var i = 0, ci; ci = cs[i]; i++){\r
-            if(ci && ci.id == id){\r
-                result[++ri] = ci;\r
-                return result;\r
-            }\r
-        }\r
-        return result;\r
-    }\r
-\r
-    // operators are =, !=, ^=, $=, *=, %=, |= and ~=\r
-    // custom can be "{"\r
-    function byAttribute(cs, attr, value, op, custom){\r
-        var result = [], \r
-            ri = -1, \r
-            useGetStyle = custom == "{",           \r
-            fn = Ext.DomQuery.operators[op],       \r
-            a,     \r
-            innerHTML;\r
-        for(var i = 0, ci; ci = cs[i]; i++){\r
-           // skip non-element nodes.\r
-            if(ci.nodeType != 1){\r
-                continue;\r
-            }\r
-           \r
-            innerHTML = ci.innerHTML;\r
-            // we only need to change the property names if we're dealing with html nodes, not XML\r
-            if(innerHTML !== null && innerHTML !== undefined){\r
-                if(useGetStyle){\r
-                    a = Ext.DomQuery.getStyle(ci, attr);\r
-                } else if (attr == "class" || attr == "className"){\r
-                    a = ci.className;\r
-                } else if (attr == "for"){\r
-                    a = ci.htmlFor;\r
-                } else if (attr == "href"){\r
-                   // getAttribute href bug\r
-                   // http://www.glennjones.net/Post/809/getAttributehrefbug.htm\r
-                    a = ci.getAttribute("href", 2);\r
-                } else{\r
-                    a = ci.getAttribute(attr);\r
-                }\r
-            }else{\r
-                a = ci.getAttribute(attr);\r
-            }\r
-            if((fn && fn(a, value)) || (!fn && a)){\r
-                result[++ri] = ci;\r
-            }\r
-        }\r
-        return result;\r
-    }\r
-\r
-    function byPseudo(cs, name, value){\r
-        return Ext.DomQuery.pseudos[name](cs, value);\r
-    }\r
-\r
-    function nodupIEXml(cs){\r
-        var d = ++key, \r
-            r;\r
-        cs[0].setAttribute("_nodup", d);\r
-        r = [cs[0]];\r
-        for(var i = 1, len = cs.length; i < len; i++){\r
-            var c = cs[i];\r
-            if(!c.getAttribute("_nodup") != d){\r
-                c.setAttribute("_nodup", d);\r
-                r[r.length] = c;\r
-            }\r
-        }\r
-        for(var i = 0, len = cs.length; i < len; i++){\r
-            cs[i].removeAttribute("_nodup");\r
-        }\r
-        return r;\r
-    }\r
-\r
-    function nodup(cs){\r
-        if(!cs){\r
-            return [];\r
-        }\r
-        var len = cs.length, c, i, r = cs, cj, ri = -1;\r
-        if(!len || typeof cs.nodeType != "undefined" || len == 1){\r
-            return cs;\r
-        }\r
-        if(isIE && typeof cs[0].selectSingleNode != "undefined"){\r
-            return nodupIEXml(cs);\r
-        }\r
-        var d = ++key;\r
-        cs[0]._nodup = d;\r
-        for(i = 1; c = cs[i]; i++){\r
-            if(c._nodup != d){\r
-                c._nodup = d;\r
-            }else{\r
-                r = [];\r
-                for(var j = 0; j < i; j++){\r
-                    r[++ri] = cs[j];\r
-                }\r
-                for(j = i+1; cj = cs[j]; j++){\r
-                    if(cj._nodup != d){\r
-                        cj._nodup = d;\r
-                        r[++ri] = cj;\r
-                    }\r
-                }\r
-                return r;\r
-            }\r
-        }\r
-        return r;\r
-    }\r
-\r
-    function quickDiffIEXml(c1, c2){\r
-        var d = ++key,\r
-            r = [];\r
-        for(var i = 0, len = c1.length; i < len; i++){\r
-            c1[i].setAttribute("_qdiff", d);\r
-        }        \r
-        for(var i = 0, len = c2.length; i < len; i++){\r
-            if(c2[i].getAttribute("_qdiff") != d){\r
-                r[r.length] = c2[i];\r
-            }\r
-        }\r
-        for(var i = 0, len = c1.length; i < len; i++){\r
-           c1[i].removeAttribute("_qdiff");\r
-        }\r
-        return r;\r
-    }\r
-\r
-    function quickDiff(c1, c2){\r
-        var len1 = c1.length,\r
-               d = ++key,\r
-               r = [];\r
-        if(!len1){\r
-            return c2;\r
-        }\r
-        if(isIE && typeof c1[0].selectSingleNode != "undefined"){\r
-            return quickDiffIEXml(c1, c2);\r
-        }        \r
-        for(var i = 0; i < len1; i++){\r
-            c1[i]._qdiff = d;\r
-        }        \r
-        for(var i = 0, len = c2.length; i < len; i++){\r
-            if(c2[i]._qdiff != d){\r
-                r[r.length] = c2[i];\r
-            }\r
-        }\r
-        return r;\r
-    }\r
-\r
-    function quickId(ns, mode, root, id){\r
-        if(ns == root){\r
-           var d = root.ownerDocument || root;\r
-           return d.getElementById(id);\r
-        }\r
-        ns = getNodes(ns, mode, "*");\r
-        return byId(ns, id);\r
-    }\r
-\r
-    return {\r
-        getStyle : function(el, name){\r
-            return Ext.fly(el).getStyle(name);\r
-        },\r
-        <div id="method-Ext.DomQuery-compile"></div>/**\r
-         * Compiles a selector/xpath query into a reusable function. The returned function\r
-         * takes one parameter "root" (optional), which is the context node from where the query should start.\r
-         * @param {String} selector The selector/xpath query\r
-         * @param {String} type (optional) Either "select" (the default) or "simple" for a simple selector match\r
-         * @return {Function}\r
-         */\r
-        compile : function(path, type){\r
-            type = type || "select";\r
-\r
-           // setup fn preamble\r
-            var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"],\r
-               mode,           \r
-               lastPath,\r
-               matchers = Ext.DomQuery.matchers,\r
-               matchersLn = matchers.length,\r
-               modeMatch,\r
-               // accept leading mode switch\r
-               lmode = path.match(modeRe);\r
-            \r
-            if(lmode && lmode[1]){\r
-                fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';\r
-                path = path.replace(lmode[1], "");\r
-            }\r
-           \r
-            // strip leading slashes\r
-            while(path.substr(0, 1)=="/"){\r
-                path = path.substr(1);\r
-            }\r
-\r
-            while(path && lastPath != path){\r
-                lastPath = path;\r
-                var tokenMatch = path.match(tagTokenRe);\r
-                if(type == "select"){\r
-                    if(tokenMatch){\r
-                       // ID Selector\r
-                        if(tokenMatch[1] == "#"){\r
-                            fn[fn.length] = 'n = quickId(n, mode, root, "'+tokenMatch[2]+'");';                        \r
-                        }else{\r
-                            fn[fn.length] = 'n = getNodes(n, mode, "'+tokenMatch[2]+'");';\r
-                        }\r
-                        path = path.replace(tokenMatch[0], "");\r
-                    }else if(path.substr(0, 1) != '@'){\r
-                        fn[fn.length] = 'n = getNodes(n, mode, "*");';\r
-                    }\r
-               // type of "simple"\r
-                }else{\r
-                    if(tokenMatch){\r
-                        if(tokenMatch[1] == "#"){\r
-                            fn[fn.length] = 'n = byId(n, "'+tokenMatch[2]+'");';\r
-                        }else{\r
-                            fn[fn.length] = 'n = byTag(n, "'+tokenMatch[2]+'");';\r
-                        }\r
-                        path = path.replace(tokenMatch[0], "");\r
-                    }\r
-                }\r
-                while(!(modeMatch = path.match(modeRe))){\r
-                    var matched = false;\r
-                    for(var j = 0; j < matchersLn; j++){\r
-                        var t = matchers[j];\r
-                        var m = path.match(t.re);\r
-                        if(m){\r
-                            fn[fn.length] = t.select.replace(tplRe, function(x, i){\r
-                               return m[i];\r
-                           });\r
-                            path = path.replace(m[0], "");\r
-                            matched = true;\r
-                            break;\r
-                        }\r
-                    }\r
-                    // prevent infinite loop on bad selector\r
-                    if(!matched){\r
-                        throw 'Error parsing selector, parsing failed at "' + path + '"';\r
-                    }\r
-                }\r
-                if(modeMatch[1]){\r
-                    fn[fn.length] = 'mode="'+modeMatch[1].replace(trimRe, "")+'";';\r
-                    path = path.replace(modeMatch[1], "");\r
-                }\r
-            }\r
-           // close fn out\r
-            fn[fn.length] = "return nodup(n);\n}";\r
-           \r
-           // eval fn and return it\r
-            eval(fn.join(""));\r
-            return f;\r
-        },\r
-\r
-        <div id="method-Ext.DomQuery-jsSelect"></div>/**\r
-         * Selects a group of elements.\r
-         * @param {String} selector The selector/xpath query (can be a comma separated list of selectors)\r
-         * @param {Node/String} root (optional) The start of the query (defaults to document).\r
-         * @return {Array} An Array of DOM elements which match the selector. If there are\r
-         * no matches, and empty Array is returned.\r
-         */\r
-       jsSelect: function(path, root, type){\r
-           // set root to doc if not specified.\r
-           root = root || document;\r
-           \r
-            if(typeof root == "string"){\r
-                root = document.getElementById(root);\r
-            }\r
-            var paths = path.split(","),\r
-               results = [];\r
-               \r
-           // loop over each selector\r
-            for(var i = 0, len = paths.length; i < len; i++){          \r
-                var subPath = paths[i].replace(trimRe, "");\r
-               // compile and place in cache\r
-                if(!cache[subPath]){\r
-                    cache[subPath] = Ext.DomQuery.compile(subPath);\r
-                    if(!cache[subPath]){\r
-                        throw subPath + " is not a valid selector";\r
-                    }\r
-                }\r
-                var result = cache[subPath](root);\r
-                if(result && result != document){\r
-                    results = results.concat(result);\r
-                }\r
-            }\r
-           \r
-           // if there were multiple selectors, make sure dups\r
-           // are eliminated\r
-            if(paths.length > 1){\r
-                return nodup(results);\r
-            }\r
-            return results;\r
-        },\r
-       isXml: function(el) {\r
-           var docEl = (el ? el.ownerDocument || el : 0).documentElement;\r
-           return docEl ? docEl.nodeName !== "HTML" : false;\r
-       },\r
-        select : document.querySelectorAll ? function(path, root, type) {\r
-           root = root || document;\r
-           if (!Ext.DomQuery.isXml(root)) {\r
-               try {\r
-                   var cs = root.querySelectorAll(path);\r
-                   return Ext.toArray(cs);\r
-               }\r
-               catch (ex) {}           \r
-           }       \r
-           return Ext.DomQuery.jsSelect.call(this, path, root, type);\r
-       } : function(path, root, type) {\r
-           return Ext.DomQuery.jsSelect.call(this, path, root, type);\r
-       },\r
-\r
-        <div id="method-Ext.DomQuery-selectNode"></div>/**\r
-         * Selects a single element.\r
-         * @param {String} selector The selector/xpath query\r
-         * @param {Node} root (optional) The start of the query (defaults to document).\r
-         * @return {Element} The DOM element which matched the selector.\r
-         */\r
-        selectNode : function(path, root){\r
-            return Ext.DomQuery.select(path, root)[0];\r
-        },\r
-\r
-        <div id="method-Ext.DomQuery-selectValue"></div>/**\r
-         * Selects the value of a node, optionally replacing null with the defaultValue.\r
-         * @param {String} selector The selector/xpath query\r
-         * @param {Node} root (optional) The start of the query (defaults to document).\r
-         * @param {String} defaultValue\r
-         * @return {String}\r
-         */\r
-        selectValue : function(path, root, defaultValue){\r
-            path = path.replace(trimRe, "");\r
-            if(!valueCache[path]){\r
-                valueCache[path] = Ext.DomQuery.compile(path, "select");\r
-            }\r
-            var n = valueCache[path](root), v;\r
-            n = n[0] ? n[0] : n;\r
-                   \r
-           // overcome a limitation of maximum textnode size\r
-           // Rumored to potentially crash IE6 but has not been confirmed.\r
-           // http://reference.sitepoint.com/javascript/Node/normalize\r
-           // https://developer.mozilla.org/En/DOM/Node.normalize          \r
-            if (typeof n.normalize == 'function') n.normalize();\r
-            \r
-            v = (n && n.firstChild ? n.firstChild.nodeValue : null);\r
-            return ((v === null||v === undefined||v==='') ? defaultValue : v);\r
-        },\r
-\r
-        <div id="method-Ext.DomQuery-selectNumber"></div>/**\r
-         * Selects the value of a node, parsing integers and floats. Returns the defaultValue, or 0 if none is specified.\r
-         * @param {String} selector The selector/xpath query\r
-         * @param {Node} root (optional) The start of the query (defaults to document).\r
-         * @param {Number} defaultValue\r
-         * @return {Number}\r
-         */\r
-        selectNumber : function(path, root, defaultValue){\r
-            var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);\r
-            return parseFloat(v);\r
-        },\r
-\r
-        <div id="method-Ext.DomQuery-is"></div>/**\r
-         * Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)\r
-         * @param {String/HTMLElement/Array} el An element id, element or array of elements\r
-         * @param {String} selector The simple selector to test\r
-         * @return {Boolean}\r
-         */\r
-        is : function(el, ss){\r
-            if(typeof el == "string"){\r
-                el = document.getElementById(el);\r
-            }\r
-            var isArray = Ext.isArray(el),\r
-               result = Ext.DomQuery.filter(isArray ? el : [el], ss);\r
-            return isArray ? (result.length == el.length) : (result.length > 0);\r
-        },\r
-\r
-        <div id="method-Ext.DomQuery-filter"></div>/**\r
-         * Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)\r
-         * @param {Array} el An array of elements to filter\r
-         * @param {String} selector The simple selector to test\r
-         * @param {Boolean} nonMatches If true, it returns the elements that DON'T match\r
-         * the selector instead of the ones that match\r
-         * @return {Array} An Array of DOM elements which match the selector. If there are\r
-         * no matches, and empty Array is returned.\r
-         */\r
-        filter : function(els, ss, nonMatches){\r
-            ss = ss.replace(trimRe, "");\r
-            if(!simpleCache[ss]){\r
-                simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");\r
-            }\r
-            var result = simpleCache[ss](els);\r
-            return nonMatches ? quickDiff(result, els) : result;\r
-        },\r
-\r
-        <div id="prop-Ext.DomQuery-matchers"></div>/**\r
-         * Collection of matching regular expressions and code snippets.\r
-         * Each capture group within () will be replace the {} in the select\r
-         * statement as specified by their index.\r
-         */\r
-        matchers : [{\r
-                re: /^\.([\w-]+)/,\r
-                select: 'n = byClassName(n, " {1} ");'\r
-            }, {\r
-                re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,\r
-                select: 'n = byPseudo(n, "{1}", "{2}");'\r
-            },{\r
-                re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,\r
-                select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'\r
-            }, {\r
-                re: /^#([\w-]+)/,\r
-                select: 'n = byId(n, "{1}");'\r
-            },{\r
-                re: /^@([\w-]+)/,\r
-                select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'\r
-            }\r
-        ],\r
-\r
-        <div id="method-Ext.DomQuery-operators"></div>/**\r
-         * Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *=, %=, |= and ~=.\r
-         * 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;.\r
-         */\r
-        operators : {\r
-            "=" : function(a, v){\r
-                return a == v;\r
-            },\r
-            "!=" : function(a, v){\r
-                return a != v;\r
-            },\r
-            "^=" : function(a, v){\r
-                return a && a.substr(0, v.length) == v;\r
-            },\r
-            "$=" : function(a, v){\r
-                return a && a.substr(a.length-v.length) == v;\r
-            },\r
-            "*=" : function(a, v){\r
-                return a && a.indexOf(v) !== -1;\r
-            },\r
-            "%=" : function(a, v){\r
-                return (a % v) == 0;\r
-            },\r
-            "|=" : function(a, v){\r
-                return a && (a == v || a.substr(0, v.length+1) == v+'-');\r
-            },\r
-            "~=" : function(a, v){\r
-                return a && (' '+a+' ').indexOf(' '+v+' ') != -1;\r
-            }\r
-        },\r
-\r
-        <div id="prop-Ext.DomQuery-pseudos"></div>/**\r
-         * <p>Object hash of "pseudo class" filter functions which are used when filtering selections. Each function is passed\r
-         * two parameters:</p><div class="mdetail-params"><ul>\r
-         * <li><b>c</b> : Array<div class="sub-desc">An Array of DOM elements to filter.</div></li>\r
-         * <li><b>v</b> : String<div class="sub-desc">The argument (if any) supplied in the selector.</div></li>\r
-         * </ul></div>\r
-         * <p>A filter function returns an Array of DOM elements which conform to the pseudo class.</p>\r
-         * <p>In addition to the provided pseudo classes listed above such as <code>first-child</code> and <code>nth-child</code>,\r
-         * developers may add additional, custom psuedo class filters to select elements according to application-specific requirements.</p>\r
-         * <p>For example, to filter <code>&lt;a></code> elements to only return links to <i>external</i> resources:</p>\r
-         * <code><pre>\r
-Ext.DomQuery.pseudos.external = function(c, v){\r
-    var r = [], ri = -1;\r
-    for(var i = 0, ci; ci = c[i]; i++){\r
-//      Include in result set only if it's a link to an external resource\r
-        if(ci.hostname != location.hostname){\r
-            r[++ri] = ci;\r
-        }\r
-    }\r
-    return r;\r
-};</pre></code>\r
-         * Then external links could be gathered with the following statement:<code><pre>\r
-var externalLinks = Ext.select("a:external");\r
-</code></pre>\r
-         */\r
-        pseudos : {\r
-            "first-child" : function(c){\r
-                var r = [], ri = -1, n;\r
-                for(var i = 0, ci; ci = n = c[i]; i++){\r
-                    while((n = n.previousSibling) && n.nodeType != 1);\r
-                    if(!n){\r
-                        r[++ri] = ci;\r
-                    }\r
-                }\r
-                return r;\r
-            },\r
-\r
-            "last-child" : function(c){\r
-                var r = [], ri = -1, n;\r
-                for(var i = 0, ci; ci = n = c[i]; i++){\r
-                    while((n = n.nextSibling) && n.nodeType != 1);\r
-                    if(!n){\r
-                        r[++ri] = ci;\r
-                    }\r
-                }\r
-                return r;\r
-            },\r
-\r
-            "nth-child" : function(c, a) {\r
-                var r = [], ri = -1,\r
-                       m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a),\r
-                       f = (m[1] || 1) - 0, l = m[2] - 0;\r
-                for(var i = 0, n; n = c[i]; i++){\r
-                    var pn = n.parentNode;\r
-                    if (batch != pn._batch) {\r
-                        var j = 0;\r
-                        for(var cn = pn.firstChild; cn; cn = cn.nextSibling){\r
-                            if(cn.nodeType == 1){\r
-                               cn.nodeIndex = ++j;\r
-                            }\r
-                        }\r
-                        pn._batch = batch;\r
-                    }\r
-                    if (f == 1) {\r
-                        if (l == 0 || n.nodeIndex == l){\r
-                            r[++ri] = n;\r
-                        }\r
-                    } else if ((n.nodeIndex + l) % f == 0){\r
-                        r[++ri] = n;\r
-                    }\r
-                }\r
-\r
-                return r;\r
-            },\r
-\r
-            "only-child" : function(c){\r
-                var r = [], ri = -1;;\r
-                for(var i = 0, ci; ci = c[i]; i++){\r
-                    if(!prev(ci) && !next(ci)){\r
-                        r[++ri] = ci;\r
-                    }\r
-                }\r
-                return r;\r
-            },\r
-\r
-            "empty" : function(c){\r
-                var r = [], ri = -1;\r
-                for(var i = 0, ci; ci = c[i]; i++){\r
-                    var cns = ci.childNodes, j = 0, cn, empty = true;\r
-                    while(cn = cns[j]){\r
-                        ++j;\r
-                        if(cn.nodeType == 1 || cn.nodeType == 3){\r
-                            empty = false;\r
-                            break;\r
-                        }\r
-                    }\r
-                    if(empty){\r
-                        r[++ri] = ci;\r
-                    }\r
-                }\r
-                return r;\r
-            },\r
-\r
-            "contains" : function(c, v){\r
-                var r = [], ri = -1;\r
-                for(var i = 0, ci; ci = c[i]; i++){\r
-                    if((ci.textContent||ci.innerText||'').indexOf(v) != -1){\r
-                        r[++ri] = ci;\r
-                    }\r
-                }\r
-                return r;\r
-            },\r
-\r
-            "nodeValue" : function(c, v){\r
-                var r = [], ri = -1;\r
-                for(var i = 0, ci; ci = c[i]; i++){\r
-                    if(ci.firstChild && ci.firstChild.nodeValue == v){\r
-                        r[++ri] = ci;\r
-                    }\r
-                }\r
-                return r;\r
-            },\r
-\r
-            "checked" : function(c){\r
-                var r = [], ri = -1;\r
-                for(var i = 0, ci; ci = c[i]; i++){\r
-                    if(ci.checked == true){\r
-                        r[++ri] = ci;\r
-                    }\r
-                }\r
-                return r;\r
-            },\r
-\r
-            "not" : function(c, ss){\r
-                return Ext.DomQuery.filter(c, ss, true);\r
-            },\r
-\r
-            "any" : function(c, selectors){\r
-                var ss = selectors.split('|'),\r
-                       r = [], ri = -1, s;\r
-                for(var i = 0, ci; ci = c[i]; i++){\r
-                    for(var j = 0; s = ss[j]; j++){\r
-                        if(Ext.DomQuery.is(ci, s)){\r
-                            r[++ri] = ci;\r
-                            break;\r
-                        }\r
-                    }\r
-                }\r
-                return r;\r
-            },\r
-\r
-            "odd" : function(c){\r
-                return this["nth-child"](c, "odd");\r
-            },\r
-\r
-            "even" : function(c){\r
-                return this["nth-child"](c, "even");\r
-            },\r
-\r
-            "nth" : function(c, a){\r
-                return c[a-1] || [];\r
-            },\r
-\r
-            "first" : function(c){\r
-                return c[0] || [];\r
-            },\r
-\r
-            "last" : function(c){\r
-                return c[c.length-1] || [];\r
-            },\r
-\r
-            "has" : function(c, ss){\r
-                var s = Ext.DomQuery.select,\r
-                       r = [], ri = -1;\r
-                for(var i = 0, ci; ci = c[i]; i++){\r
-                    if(s(ss, ci).length > 0){\r
-                        r[++ri] = ci;\r
-                    }\r
-                }\r
-                return r;\r
-            },\r
-\r
-            "next" : function(c, ss){\r
-                var is = Ext.DomQuery.is,\r
-                       r = [], ri = -1;\r
-                for(var i = 0, ci; ci = c[i]; i++){\r
-                    var n = next(ci);\r
-                    if(n && is(n, ss)){\r
-                        r[++ri] = ci;\r
-                    }\r
-                }\r
-                return r;\r
-            },\r
-\r
-            "prev" : function(c, ss){\r
-                var is = Ext.DomQuery.is,\r
-                       r = [], ri = -1;\r
-                for(var i = 0, ci; ci = c[i]; i++){\r
-                    var n = prev(ci);\r
-                    if(n && is(n, ss)){\r
-                        r[++ri] = ci;\r
-                    }\r
-                }\r
-                return r;\r
-            }\r
-        }\r
-    };\r
-}();\r
-\r
-<div id="method-Ext-query"></div>/**\r
- * Selects an array of DOM nodes by CSS/XPath selector. Shorthand of {@link Ext.DomQuery#select}\r
- * @param {String} path The selector/xpath query\r
- * @param {Node} root (optional) The start of the query (defaults to document).\r
- * @return {Array}\r
- * @member Ext\r
- * @method query\r
- */\r
-Ext.query = Ext.DomQuery.select;\r
-</pre>    \r
-</body>\r
-</html>
\ No newline at end of file
+<!DOCTYPE html>
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <title>The source code</title>
+  <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
+  <script type="text/javascript" src="../prettify/prettify.js"></script>
+  <style type="text/css">
+    .highlight { display: block; background-color: #ddd; }
+  </style>
+  <script type="text/javascript">
+    function highlight() {
+      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
+    }
+  </script>
+</head>
+<body onload="prettyPrint(); highlight();">
+  <pre class="prettyprint lang-js">/*
+ * This is code is also distributed under MIT license for use
+ * with jQuery and prototype JavaScript libraries.
+ */
+<span id='Ext-DomQuery'>/**
+</span> * @class Ext.DomQuery
+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).
+&lt;p&gt;
+DomQuery supports most of the &lt;a href=&quot;http://www.w3.org/TR/2005/WD-css3-selectors-20051215/#selectors&quot;&gt;CSS3 selectors spec&lt;/a&gt;, along with some custom selectors and basic XPath.&lt;/p&gt;
+
+&lt;p&gt;
+All selectors, attribute filters and pseudos below can be combined infinitely in any order. For example &quot;div.foo:nth-child(odd)[@foo=bar].bar:first&quot; 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.
+&lt;/p&gt;
+&lt;h4&gt;Element Selectors:&lt;/h4&gt;
+&lt;ul class=&quot;list&quot;&gt;
+    &lt;li&gt; &lt;b&gt;*&lt;/b&gt; any element&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E&lt;/b&gt; an element with the tag E&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E F&lt;/b&gt; All descendent elements of E that have the tag F&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E &gt; F&lt;/b&gt; or &lt;b&gt;E/F&lt;/b&gt; all direct children elements of E that have the tag F&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E + F&lt;/b&gt; all elements with the tag F that are immediately preceded by an element with the tag E&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E ~ F&lt;/b&gt; all elements with the tag F that are preceded by a sibling element with the tag E&lt;/li&gt;
+&lt;/ul&gt;
+&lt;h4&gt;Attribute Selectors:&lt;/h4&gt;
+&lt;p&gt;The use of &amp;#64; and quotes are optional. For example, div[&amp;#64;foo='bar'] is also a valid attribute selector.&lt;/p&gt;
+&lt;ul class=&quot;list&quot;&gt;
+    &lt;li&gt; &lt;b&gt;E[foo]&lt;/b&gt; has an attribute &quot;foo&quot;&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E[foo=bar]&lt;/b&gt; has an attribute &quot;foo&quot; that equals &quot;bar&quot;&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E[foo^=bar]&lt;/b&gt; has an attribute &quot;foo&quot; that starts with &quot;bar&quot;&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E[foo$=bar]&lt;/b&gt; has an attribute &quot;foo&quot; that ends with &quot;bar&quot;&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E[foo*=bar]&lt;/b&gt; has an attribute &quot;foo&quot; that contains the substring &quot;bar&quot;&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E[foo%=2]&lt;/b&gt; has an attribute &quot;foo&quot; that is evenly divisible by 2&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E[foo!=bar]&lt;/b&gt; attribute &quot;foo&quot; does not equal &quot;bar&quot;&lt;/li&gt;
+&lt;/ul&gt;
+&lt;h4&gt;Pseudo Classes:&lt;/h4&gt;
+&lt;ul class=&quot;list&quot;&gt;
+    &lt;li&gt; &lt;b&gt;E:first-child&lt;/b&gt; E is the first child of its parent&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:last-child&lt;/b&gt; E is the last child of its parent&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:nth-child(&lt;i&gt;n&lt;/i&gt;)&lt;/b&gt; E is the &lt;i&gt;n&lt;/i&gt;th child of its parent (1 based as per the spec)&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:nth-child(odd)&lt;/b&gt; E is an odd child of its parent&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:nth-child(even)&lt;/b&gt; E is an even child of its parent&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:only-child&lt;/b&gt; E is the only child of its parent&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:checked&lt;/b&gt; E is an element that is has a checked attribute that is true (e.g. a radio or checkbox) &lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:first&lt;/b&gt; the first E in the resultset&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:last&lt;/b&gt; the last E in the resultset&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:nth(&lt;i&gt;n&lt;/i&gt;)&lt;/b&gt; the &lt;i&gt;n&lt;/i&gt;th E in the resultset (1 based)&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:odd&lt;/b&gt; shortcut for :nth-child(odd)&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:even&lt;/b&gt; shortcut for :nth-child(even)&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:contains(foo)&lt;/b&gt; E's innerHTML contains the substring &quot;foo&quot;&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:nodeValue(foo)&lt;/b&gt; E contains a textNode with a nodeValue that equals &quot;foo&quot;&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:not(S)&lt;/b&gt; an E element that does not match simple selector S&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:has(S)&lt;/b&gt; an E element that has a descendent that matches simple selector S&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:next(S)&lt;/b&gt; an E element whose next sibling matches simple selector S&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:prev(S)&lt;/b&gt; an E element whose previous sibling matches simple selector S&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E:any(S1|S2|S2)&lt;/b&gt; an E element which matches any of the simple selectors S1, S2 or S3//\\&lt;/li&gt;
+&lt;/ul&gt;
+&lt;h4&gt;CSS Value Selectors:&lt;/h4&gt;
+&lt;ul class=&quot;list&quot;&gt;
+    &lt;li&gt; &lt;b&gt;E{display=none}&lt;/b&gt; css value &quot;display&quot; that equals &quot;none&quot;&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E{display^=none}&lt;/b&gt; css value &quot;display&quot; that starts with &quot;none&quot;&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E{display$=none}&lt;/b&gt; css value &quot;display&quot; that ends with &quot;none&quot;&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E{display*=none}&lt;/b&gt; css value &quot;display&quot; that contains the substring &quot;none&quot;&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E{display%=2}&lt;/b&gt; css value &quot;display&quot; that is evenly divisible by 2&lt;/li&gt;
+    &lt;li&gt; &lt;b&gt;E{display!=none}&lt;/b&gt; css value &quot;display&quot; that does not equal &quot;none&quot;&lt;/li&gt;
+&lt;/ul&gt;
+ * @singleton
+ */
+Ext.ns('Ext.core');
+
+Ext.core.DomQuery = Ext.DomQuery = function(){
+    var cache = {},
+        simpleCache = {},
+        valueCache = {},
+        nonSpace = /\S/,
+        trimRe = /^\s+|\s+$/g,
+        tplRe = /\{(\d+)\}/g,
+        modeRe = /^(\s?[\/&gt;+~]\s?|\s|$)/,
+        tagTokenRe = /^(#)?([\w-\*]+)/,
+        nthRe = /(\d*)n\+?(\d*)/,
+        nthRe2 = /\D/,
+        // This is for IE MSXML which does not support expandos.
+    // IE runs the same speed using setAttribute, however FF slows way down
+    // and Safari completely fails so they need to continue to use expandos.
+    isIE = window.ActiveXObject ? true : false,
+    key = 30803;
+
+    // this eval is stop the compressor from
+    // renaming the variable to something shorter
+    eval(&quot;var batch = 30803;&quot;);
+
+    // Retrieve the child node from a particular
+    // parent at the specified index.
+    function child(parent, index){
+        var i = 0,
+            n = parent.firstChild;
+        while(n){
+            if(n.nodeType == 1){
+               if(++i == index){
+                   return n;
+               }
+            }
+            n = n.nextSibling;
+        }
+        return null;
+    }
+
+    // retrieve the next element node
+    function next(n){
+        while((n = n.nextSibling) &amp;&amp; n.nodeType != 1);
+        return n;
+    }
+
+    // retrieve the previous element node
+    function prev(n){
+        while((n = n.previousSibling) &amp;&amp; n.nodeType != 1);
+        return n;
+    }
+
+    // Mark each child node with a nodeIndex skipping and
+    // removing empty text nodes.
+    function children(parent){
+        var n = parent.firstChild,
+        nodeIndex = -1,
+        nextNode;
+        while(n){
+            nextNode = n.nextSibling;
+            // clean worthless empty nodes.
+            if(n.nodeType == 3 &amp;&amp; !nonSpace.test(n.nodeValue)){
+            parent.removeChild(n);
+            }else{
+            // add an expando nodeIndex
+            n.nodeIndex = ++nodeIndex;
+            }
+            n = nextNode;
+        }
+        return this;
+    }
+
+
+    // nodeSet - array of nodes
+    // cls - CSS Class
+    function byClassName(nodeSet, cls){
+        if(!cls){
+            return nodeSet;
+        }
+        var result = [], ri = -1;
+        for(var i = 0, ci; ci = nodeSet[i]; i++){
+            if((' '+ci.className+' ').indexOf(cls) != -1){
+                result[++ri] = ci;
+            }
+        }
+        return result;
+    };
+
+    function attrValue(n, attr){
+        // if its an array, use the first node.
+        if(!n.tagName &amp;&amp; typeof n.length != &quot;undefined&quot;){
+            n = n[0];
+        }
+        if(!n){
+            return null;
+        }
+
+        if(attr == &quot;for&quot;){
+            return n.htmlFor;
+        }
+        if(attr == &quot;class&quot; || attr == &quot;className&quot;){
+            return n.className;
+        }
+        return n.getAttribute(attr) || n[attr];
+
+    };
+
+
+    // ns - nodes
+    // mode - false, /, &gt;, +, ~
+    // tagName - defaults to &quot;*&quot;
+    function getNodes(ns, mode, tagName){
+        var result = [], ri = -1, cs;
+        if(!ns){
+            return result;
+        }
+        tagName = tagName || &quot;*&quot;;
+        // convert to array
+        if(typeof ns.getElementsByTagName != &quot;undefined&quot;){
+            ns = [ns];
+        }
+
+        // no mode specified, grab all elements by tagName
+        // at any depth
+        if(!mode){
+            for(var i = 0, ni; ni = ns[i]; i++){
+                cs = ni.getElementsByTagName(tagName);
+                for(var j = 0, ci; ci = cs[j]; j++){
+                    result[++ri] = ci;
+                }
+            }
+        // Direct Child mode (/ or &gt;)
+        // E &gt; F or E/F all direct children elements of E that have the tag
+        } else if(mode == &quot;/&quot; || mode == &quot;&gt;&quot;){
+            var utag = tagName.toUpperCase();
+            for(var i = 0, ni, cn; ni = ns[i]; i++){
+                cn = ni.childNodes;
+                for(var j = 0, cj; cj = cn[j]; j++){
+                    if(cj.nodeName == utag || cj.nodeName == tagName  || tagName == '*'){
+                        result[++ri] = cj;
+                    }
+                }
+            }
+        // Immediately Preceding mode (+)
+        // E + F all elements with the tag F that are immediately preceded by an element with the tag E
+        }else if(mode == &quot;+&quot;){
+            var utag = tagName.toUpperCase();
+            for(var i = 0, n; n = ns[i]; i++){
+                while((n = n.nextSibling) &amp;&amp; n.nodeType != 1);
+                if(n &amp;&amp; (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
+                    result[++ri] = n;
+                }
+            }
+        // Sibling mode (~)
+        // E ~ F all elements with the tag F that are preceded by a sibling element with the tag E
+        }else if(mode == &quot;~&quot;){
+            var utag = tagName.toUpperCase();
+            for(var i = 0, n; n = ns[i]; i++){
+                while((n = n.nextSibling)){
+                    if (n.nodeName == utag || n.nodeName == tagName || tagName == '*'){
+                        result[++ri] = n;
+                    }
+                }
+            }
+        }
+        return result;
+    }
+
+    function concat(a, b){
+        if(b.slice){
+            return a.concat(b);
+        }
+        for(var i = 0, l = b.length; i &lt; l; i++){
+            a[a.length] = b[i];
+        }
+        return a;
+    }
+
+    function byTag(cs, tagName){
+        if(cs.tagName || cs == document){
+            cs = [cs];
+        }
+        if(!tagName){
+            return cs;
+        }
+        var result = [], ri = -1;
+        tagName = tagName.toLowerCase();
+        for(var i = 0, ci; ci = cs[i]; i++){
+            if(ci.nodeType == 1 &amp;&amp; ci.tagName.toLowerCase() == tagName){
+                result[++ri] = ci;
+            }
+        }
+        return result;
+    }
+
+    function byId(cs, id){
+        if(cs.tagName || cs == document){
+            cs = [cs];
+        }
+        if(!id){
+            return cs;
+        }
+        var result = [], ri = -1;
+        for(var i = 0, ci; ci = cs[i]; i++){
+            if(ci &amp;&amp; ci.id == id){
+                result[++ri] = ci;
+                return result;
+            }
+        }
+        return result;
+    }
+
+    // operators are =, !=, ^=, $=, *=, %=, |= and ~=
+    // custom can be &quot;{&quot;
+    function byAttribute(cs, attr, value, op, custom){
+        var result = [],
+            ri = -1,
+            useGetStyle = custom == &quot;{&quot;,
+            fn = Ext.DomQuery.operators[op],
+            a,
+            xml,
+            hasXml;
+
+        for(var i = 0, ci; ci = cs[i]; i++){
+            // skip non-element nodes.
+            if(ci.nodeType != 1){
+                continue;
+            }
+            // only need to do this for the first node
+            if(!hasXml){
+                xml = Ext.DomQuery.isXml(ci);
+                hasXml = true;
+            }
+
+            // we only need to change the property names if we're dealing with html nodes, not XML
+            if(!xml){
+                if(useGetStyle){
+                    a = Ext.DomQuery.getStyle(ci, attr);
+                } else if (attr == &quot;class&quot; || attr == &quot;className&quot;){
+                    a = ci.className;
+                } else if (attr == &quot;for&quot;){
+                    a = ci.htmlFor;
+                } else if (attr == &quot;href&quot;){
+                    // getAttribute href bug
+                    // http://www.glennjones.net/Post/809/getAttributehrefbug.htm
+                    a = ci.getAttribute(&quot;href&quot;, 2);
+                } else{
+                    a = ci.getAttribute(attr);
+                }
+            }else{
+                a = ci.getAttribute(attr);
+            }
+            if((fn &amp;&amp; fn(a, value)) || (!fn &amp;&amp; a)){
+                result[++ri] = ci;
+            }
+        }
+        return result;
+    }
+
+    function byPseudo(cs, name, value){
+        return Ext.DomQuery.pseudos[name](cs, value);
+    }
+
+    function nodupIEXml(cs){
+        var d = ++key,
+            r;
+        cs[0].setAttribute(&quot;_nodup&quot;, d);
+        r = [cs[0]];
+        for(var i = 1, len = cs.length; i &lt; len; i++){
+            var c = cs[i];
+            if(!c.getAttribute(&quot;_nodup&quot;) != d){
+                c.setAttribute(&quot;_nodup&quot;, d);
+                r[r.length] = c;
+            }
+        }
+        for(var i = 0, len = cs.length; i &lt; len; i++){
+            cs[i].removeAttribute(&quot;_nodup&quot;);
+        }
+        return r;
+    }
+
+    function nodup(cs){
+        if(!cs){
+            return [];
+        }
+        var len = cs.length, c, i, r = cs, cj, ri = -1;
+        if(!len || typeof cs.nodeType != &quot;undefined&quot; || len == 1){
+            return cs;
+        }
+        if(isIE &amp;&amp; typeof cs[0].selectSingleNode != &quot;undefined&quot;){
+            return nodupIEXml(cs);
+        }
+        var d = ++key;
+        cs[0]._nodup = d;
+        for(i = 1; c = cs[i]; i++){
+            if(c._nodup != d){
+                c._nodup = d;
+            }else{
+                r = [];
+                for(var j = 0; j &lt; i; j++){
+                    r[++ri] = cs[j];
+                }
+                for(j = i+1; cj = cs[j]; j++){
+                    if(cj._nodup != d){
+                        cj._nodup = d;
+                        r[++ri] = cj;
+                    }
+                }
+                return r;
+            }
+        }
+        return r;
+    }
+
+    function quickDiffIEXml(c1, c2){
+        var d = ++key,
+            r = [];
+        for(var i = 0, len = c1.length; i &lt; len; i++){
+            c1[i].setAttribute(&quot;_qdiff&quot;, d);
+        }
+        for(var i = 0, len = c2.length; i &lt; len; i++){
+            if(c2[i].getAttribute(&quot;_qdiff&quot;) != d){
+                r[r.length] = c2[i];
+            }
+        }
+        for(var i = 0, len = c1.length; i &lt; len; i++){
+           c1[i].removeAttribute(&quot;_qdiff&quot;);
+        }
+        return r;
+    }
+
+    function quickDiff(c1, c2){
+        var len1 = c1.length,
+            d = ++key,
+            r = [];
+        if(!len1){
+            return c2;
+        }
+        if(isIE &amp;&amp; typeof c1[0].selectSingleNode != &quot;undefined&quot;){
+            return quickDiffIEXml(c1, c2);
+        }
+        for(var i = 0; i &lt; len1; i++){
+            c1[i]._qdiff = d;
+        }
+        for(var i = 0, len = c2.length; i &lt; len; i++){
+            if(c2[i]._qdiff != d){
+                r[r.length] = c2[i];
+            }
+        }
+        return r;
+    }
+
+    function quickId(ns, mode, root, id){
+        if(ns == root){
+           var d = root.ownerDocument || root;
+           return d.getElementById(id);
+        }
+        ns = getNodes(ns, mode, &quot;*&quot;);
+        return byId(ns, id);
+    }
+
+    return {
+        getStyle : function(el, name){
+            return Ext.fly(el).getStyle(name);
+        },
+<span id='Ext-DomQuery-method-compile'>        /**
+</span>         * Compiles a selector/xpath query into a reusable function. The returned function
+         * takes one parameter &quot;root&quot; (optional), which is the context node from where the query should start.
+         * @param {String} selector The selector/xpath query
+         * @param {String} type (optional) Either &quot;select&quot; (the default) or &quot;simple&quot; for a simple selector match
+         * @return {Function}
+         */
+        compile : function(path, type){
+            type = type || &quot;select&quot;;
+
+            // setup fn preamble
+            var fn = [&quot;var f = function(root){\n var mode; ++batch; var n = root || document;\n&quot;],
+                mode,
+                lastPath,
+                matchers = Ext.DomQuery.matchers,
+                matchersLn = matchers.length,
+                modeMatch,
+                // accept leading mode switch
+                lmode = path.match(modeRe);
+
+            if(lmode &amp;&amp; lmode[1]){
+                fn[fn.length] = 'mode=&quot;'+lmode[1].replace(trimRe, &quot;&quot;)+'&quot;;';
+                path = path.replace(lmode[1], &quot;&quot;);
+            }
+
+            // strip leading slashes
+            while(path.substr(0, 1)==&quot;/&quot;){
+                path = path.substr(1);
+            }
+
+            while(path &amp;&amp; lastPath != path){
+                lastPath = path;
+                var tokenMatch = path.match(tagTokenRe);
+                if(type == &quot;select&quot;){
+                    if(tokenMatch){
+                        // ID Selector
+                        if(tokenMatch[1] == &quot;#&quot;){
+                            fn[fn.length] = 'n = quickId(n, mode, root, &quot;'+tokenMatch[2]+'&quot;);';
+                        }else{
+                            fn[fn.length] = 'n = getNodes(n, mode, &quot;'+tokenMatch[2]+'&quot;);';
+                        }
+                        path = path.replace(tokenMatch[0], &quot;&quot;);
+                    }else if(path.substr(0, 1) != '@'){
+                        fn[fn.length] = 'n = getNodes(n, mode, &quot;*&quot;);';
+                    }
+                // type of &quot;simple&quot;
+                }else{
+                    if(tokenMatch){
+                        if(tokenMatch[1] == &quot;#&quot;){
+                            fn[fn.length] = 'n = byId(n, &quot;'+tokenMatch[2]+'&quot;);';
+                        }else{
+                            fn[fn.length] = 'n = byTag(n, &quot;'+tokenMatch[2]+'&quot;);';
+                        }
+                        path = path.replace(tokenMatch[0], &quot;&quot;);
+                    }
+                }
+                while(!(modeMatch = path.match(modeRe))){
+                    var matched = false;
+                    for(var j = 0; j &lt; matchersLn; j++){
+                        var t = matchers[j];
+                        var m = path.match(t.re);
+                        if(m){
+                            fn[fn.length] = t.select.replace(tplRe, function(x, i){
+                                return m[i];
+                            });
+                            path = path.replace(m[0], &quot;&quot;);
+                            matched = true;
+                            break;
+                        }
+                    }
+                    // prevent infinite loop on bad selector
+                    if(!matched){
+                        //&lt;debug&gt;
+                        Ext.Error.raise({
+                            sourceClass: 'Ext.DomQuery',
+                            sourceMethod: 'compile',
+                            msg: 'Error parsing selector. Parsing failed at &quot;' + path + '&quot;'
+                        });
+                        //&lt;/debug&gt;
+                    }
+                }
+                if(modeMatch[1]){
+                    fn[fn.length] = 'mode=&quot;'+modeMatch[1].replace(trimRe, &quot;&quot;)+'&quot;;';
+                    path = path.replace(modeMatch[1], &quot;&quot;);
+                }
+            }
+            // close fn out
+            fn[fn.length] = &quot;return nodup(n);\n}&quot;;
+
+            // eval fn and return it
+            eval(fn.join(&quot;&quot;));
+            return f;
+        },
+
+<span id='Ext-DomQuery-method-jsSelect'>        /**
+</span>         * Selects an array of DOM nodes using JavaScript-only implementation.
+         *
+         * Use {@link #select} to take advantage of browsers built-in support for CSS selectors.
+         *
+         * @param {String} selector The selector/xpath query (can be a comma separated list of selectors)
+         * @param {Node/String} root (optional) The start of the query (defaults to document).
+         * @return {Array} An Array of DOM elements which match the selector. If there are
+         * no matches, and empty Array is returned.
+         */
+        jsSelect: function(path, root, type){
+            // set root to doc if not specified.
+            root = root || document;
+
+            if(typeof root == &quot;string&quot;){
+                root = document.getElementById(root);
+            }
+            var paths = path.split(&quot;,&quot;),
+                results = [];
+
+            // loop over each selector
+            for(var i = 0, len = paths.length; i &lt; len; i++){
+                var subPath = paths[i].replace(trimRe, &quot;&quot;);
+                // compile and place in cache
+                if(!cache[subPath]){
+                    cache[subPath] = Ext.DomQuery.compile(subPath);
+                    if(!cache[subPath]){
+                        //&lt;debug&gt;
+                        Ext.Error.raise({
+                            sourceClass: 'Ext.DomQuery',
+                            sourceMethod: 'jsSelect',
+                            msg: subPath + ' is not a valid selector'
+                        });
+                        //&lt;/debug&gt;
+                    }
+                }
+                var result = cache[subPath](root);
+                if(result &amp;&amp; result != document){
+                    results = results.concat(result);
+                }
+            }
+
+            // if there were multiple selectors, make sure dups
+            // are eliminated
+            if(paths.length &gt; 1){
+                return nodup(results);
+            }
+            return results;
+        },
+
+        isXml: function(el) {
+            var docEl = (el ? el.ownerDocument || el : 0).documentElement;
+            return docEl ? docEl.nodeName !== &quot;HTML&quot; : false;
+        },
+
+<span id='Ext-DomQuery-method-select'>        /**
+</span>         * Selects an array of DOM nodes by CSS/XPath selector.
+         *
+         * Uses [document.querySelectorAll][0] if browser supports that, otherwise falls back to
+         * {@link #jsSelect} to do the work.
+         * 
+         * Aliased as {@link Ext#query}.
+         * 
+         * [0]: https://developer.mozilla.org/en/DOM/document.querySelectorAll
+         *
+         * @param {String} path The selector/xpath query
+         * @param {Node} root (optional) The start of the query (defaults to document).
+         * @return {Array} An array of DOM elements (not a NodeList as returned by `querySelectorAll`).
+         * Empty array when no matches.
+         * @method
+         */
+        select : document.querySelectorAll ? function(path, root, type) {
+            root = root || document;
+            if (!Ext.DomQuery.isXml(root)) {
+            try {
+                var cs = root.querySelectorAll(path);
+                return Ext.Array.toArray(cs);
+            }
+            catch (ex) {}
+            }
+            return Ext.DomQuery.jsSelect.call(this, path, root, type);
+        } : function(path, root, type) {
+            return Ext.DomQuery.jsSelect.call(this, path, root, type);
+        },
+
+<span id='Ext-DomQuery-method-selectNode'>        /**
+</span>         * Selects a single element.
+         * @param {String} selector The selector/xpath query
+         * @param {Node} root (optional) The start of the query (defaults to document).
+         * @return {Element} The DOM element which matched the selector.
+         */
+        selectNode : function(path, root){
+            return Ext.DomQuery.select(path, root)[0];
+        },
+
+<span id='Ext-DomQuery-method-selectValue'>        /**
+</span>         * Selects the value of a node, optionally replacing null with the defaultValue.
+         * @param {String} selector The selector/xpath query
+         * @param {Node} root (optional) The start of the query (defaults to document).
+         * @param {String} defaultValue
+         * @return {String}
+         */
+        selectValue : function(path, root, defaultValue){
+            path = path.replace(trimRe, &quot;&quot;);
+            if(!valueCache[path]){
+                valueCache[path] = Ext.DomQuery.compile(path, &quot;select&quot;);
+            }
+            var n = valueCache[path](root), v;
+            n = n[0] ? n[0] : n;
+
+            // overcome a limitation of maximum textnode size
+            // Rumored to potentially crash IE6 but has not been confirmed.
+            // http://reference.sitepoint.com/javascript/Node/normalize
+            // https://developer.mozilla.org/En/DOM/Node.normalize
+            if (typeof n.normalize == 'function') n.normalize();
+
+            v = (n &amp;&amp; n.firstChild ? n.firstChild.nodeValue : null);
+            return ((v === null||v === undefined||v==='') ? defaultValue : v);
+        },
+
+<span id='Ext-DomQuery-method-selectNumber'>        /**
+</span>         * Selects the value of a node, parsing integers and floats. Returns the defaultValue, or 0 if none is specified.
+         * @param {String} selector The selector/xpath query
+         * @param {Node} root (optional) The start of the query (defaults to document).
+         * @param {Number} defaultValue
+         * @return {Number}
+         */
+        selectNumber : function(path, root, defaultValue){
+            var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
+            return parseFloat(v);
+        },
+
+<span id='Ext-DomQuery-method-is'>        /**
+</span>         * Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)
+         * @param {String/HTMLElement/Array} el An element id, element or array of elements
+         * @param {String} selector The simple selector to test
+         * @return {Boolean}
+         */
+        is : function(el, ss){
+            if(typeof el == &quot;string&quot;){
+                el = document.getElementById(el);
+            }
+            var isArray = Ext.isArray(el),
+                result = Ext.DomQuery.filter(isArray ? el : [el], ss);
+            return isArray ? (result.length == el.length) : (result.length &gt; 0);
+        },
+
+<span id='Ext-DomQuery-method-filter'>        /**
+</span>         * Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)
+         * @param {Array} el An array of elements to filter
+         * @param {String} selector The simple selector to test
+         * @param {Boolean} nonMatches If true, it returns the elements that DON'T match
+         * the selector instead of the ones that match
+         * @return {Array} An Array of DOM elements which match the selector. If there are
+         * no matches, and empty Array is returned.
+         */
+        filter : function(els, ss, nonMatches){
+            ss = ss.replace(trimRe, &quot;&quot;);
+            if(!simpleCache[ss]){
+                simpleCache[ss] = Ext.DomQuery.compile(ss, &quot;simple&quot;);
+            }
+            var result = simpleCache[ss](els);
+            return nonMatches ? quickDiff(result, els) : result;
+        },
+
+<span id='Ext-DomQuery-property-matchers'>        /**
+</span>         * Collection of matching regular expressions and code snippets.
+         * Each capture group within () will be replace the {} in the select
+         * statement as specified by their index.
+         */
+        matchers : [{
+                re: /^\.([\w-]+)/,
+                select: 'n = byClassName(n, &quot; {1} &quot;);'
+            }, {
+                re: /^\:([\w-]+)(?:\(((?:[^\s&gt;\/]*|.*?))\))?/,
+                select: 'n = byPseudo(n, &quot;{1}&quot;, &quot;{2}&quot;);'
+            },{
+                re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['&quot;]?(.*?)[&quot;']?)?[\]\}])/,
+                select: 'n = byAttribute(n, &quot;{2}&quot;, &quot;{4}&quot;, &quot;{3}&quot;, &quot;{1}&quot;);'
+            }, {
+                re: /^#([\w-]+)/,
+                select: 'n = byId(n, &quot;{1}&quot;);'
+            },{
+                re: /^@([\w-]+)/,
+                select: 'return {firstChild:{nodeValue:attrValue(n, &quot;{1}&quot;)}};'
+            }
+        ],
+
+<span id='Ext-DomQuery-property-operators'>        /**
+</span>         * Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *=, %=, |= and ~=.
+         * New operators can be added as long as the match the format &lt;i&gt;c&lt;/i&gt;= where &lt;i&gt;c&lt;/i&gt; is any character other than space, &amp;gt; &amp;lt;.
+         */
+        operators : {
+            &quot;=&quot; : function(a, v){
+                return a == v;
+            },
+            &quot;!=&quot; : function(a, v){
+                return a != v;
+            },
+            &quot;^=&quot; : function(a, v){
+                return a &amp;&amp; a.substr(0, v.length) == v;
+            },
+            &quot;$=&quot; : function(a, v){
+                return a &amp;&amp; a.substr(a.length-v.length) == v;
+            },
+            &quot;*=&quot; : function(a, v){
+                return a &amp;&amp; a.indexOf(v) !== -1;
+            },
+            &quot;%=&quot; : function(a, v){
+                return (a % v) == 0;
+            },
+            &quot;|=&quot; : function(a, v){
+                return a &amp;&amp; (a == v || a.substr(0, v.length+1) == v+'-');
+            },
+            &quot;~=&quot; : function(a, v){
+                return a &amp;&amp; (' '+a+' ').indexOf(' '+v+' ') != -1;
+            }
+        },
+
+<span id='Ext-DomQuery-property-pseudos'>        /**
+</span>Object hash of &quot;pseudo class&quot; filter functions which are used when filtering selections. 
+Each function is passed two parameters:
+
+- **c** : Array
+    An Array of DOM elements to filter.
+    
+- **v** : String
+    The argument (if any) supplied in the selector.
+
+A filter function returns an Array of DOM elements which conform to the pseudo class.
+In addition to the provided pseudo classes listed above such as `first-child` and `nth-child`,
+developers may add additional, custom psuedo class filters to select elements according to application-specific requirements.
+
+For example, to filter `a` elements to only return links to __external__ resources:
+
+    Ext.DomQuery.pseudos.external = function(c, v){
+        var r = [], ri = -1;
+        for(var i = 0, ci; ci = c[i]; i++){
+            // Include in result set only if it's a link to an external resource
+            if(ci.hostname != location.hostname){
+                r[++ri] = ci;
+            }
+        }
+        return r;
+    };
+
+Then external links could be gathered with the following statement:
+
+    var externalLinks = Ext.select(&quot;a:external&quot;);
+
+        * @markdown
+        */
+        pseudos : {
+            &quot;first-child&quot; : function(c){
+                var r = [], ri = -1, n;
+                for(var i = 0, ci; ci = n = c[i]; i++){
+                    while((n = n.previousSibling) &amp;&amp; n.nodeType != 1);
+                    if(!n){
+                        r[++ri] = ci;
+                    }
+                }
+                return r;
+            },
+
+            &quot;last-child&quot; : function(c){
+                var r = [], ri = -1, n;
+                for(var i = 0, ci; ci = n = c[i]; i++){
+                    while((n = n.nextSibling) &amp;&amp; n.nodeType != 1);
+                    if(!n){
+                        r[++ri] = ci;
+                    }
+                }
+                return r;
+            },
+
+            &quot;nth-child&quot; : function(c, a) {
+                var r = [], ri = -1,
+                    m = nthRe.exec(a == &quot;even&quot; &amp;&amp; &quot;2n&quot; || a == &quot;odd&quot; &amp;&amp; &quot;2n+1&quot; || !nthRe2.test(a) &amp;&amp; &quot;n+&quot; + a || a),
+                    f = (m[1] || 1) - 0, l = m[2] - 0;
+                for(var i = 0, n; n = c[i]; i++){
+                    var pn = n.parentNode;
+                    if (batch != pn._batch) {
+                        var j = 0;
+                        for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
+                            if(cn.nodeType == 1){
+                               cn.nodeIndex = ++j;
+                            }
+                        }
+                        pn._batch = batch;
+                    }
+                    if (f == 1) {
+                        if (l == 0 || n.nodeIndex == l){
+                            r[++ri] = n;
+                        }
+                    } else if ((n.nodeIndex + l) % f == 0){
+                        r[++ri] = n;
+                    }
+                }
+
+                return r;
+            },
+
+            &quot;only-child&quot; : function(c){
+                var r = [], ri = -1;;
+                for(var i = 0, ci; ci = c[i]; i++){
+                    if(!prev(ci) &amp;&amp; !next(ci)){
+                        r[++ri] = ci;
+                    }
+                }
+                return r;
+            },
+
+            &quot;empty&quot; : function(c){
+                var r = [], ri = -1;
+                for(var i = 0, ci; ci = c[i]; i++){
+                    var cns = ci.childNodes, j = 0, cn, empty = true;
+                    while(cn = cns[j]){
+                        ++j;
+                        if(cn.nodeType == 1 || cn.nodeType == 3){
+                            empty = false;
+                            break;
+                        }
+                    }
+                    if(empty){
+                        r[++ri] = ci;
+                    }
+                }
+                return r;
+            },
+
+            &quot;contains&quot; : function(c, v){
+                var r = [], ri = -1;
+                for(var i = 0, ci; ci = c[i]; i++){
+                    if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
+                        r[++ri] = ci;
+                    }
+                }
+                return r;
+            },
+
+            &quot;nodeValue&quot; : function(c, v){
+                var r = [], ri = -1;
+                for(var i = 0, ci; ci = c[i]; i++){
+                    if(ci.firstChild &amp;&amp; ci.firstChild.nodeValue == v){
+                        r[++ri] = ci;
+                    }
+                }
+                return r;
+            },
+
+            &quot;checked&quot; : function(c){
+                var r = [], ri = -1;
+                for(var i = 0, ci; ci = c[i]; i++){
+                    if(ci.checked == true){
+                        r[++ri] = ci;
+                    }
+                }
+                return r;
+            },
+
+            &quot;not&quot; : function(c, ss){
+                return Ext.DomQuery.filter(c, ss, true);
+            },
+
+            &quot;any&quot; : function(c, selectors){
+                var ss = selectors.split('|'),
+                    r = [], ri = -1, s;
+                for(var i = 0, ci; ci = c[i]; i++){
+                    for(var j = 0; s = ss[j]; j++){
+                        if(Ext.DomQuery.is(ci, s)){
+                            r[++ri] = ci;
+                            break;
+                        }
+                    }
+                }
+                return r;
+            },
+
+            &quot;odd&quot; : function(c){
+                return this[&quot;nth-child&quot;](c, &quot;odd&quot;);
+            },
+
+            &quot;even&quot; : function(c){
+                return this[&quot;nth-child&quot;](c, &quot;even&quot;);
+            },
+
+            &quot;nth&quot; : function(c, a){
+                return c[a-1] || [];
+            },
+
+            &quot;first&quot; : function(c){
+                return c[0] || [];
+            },
+
+            &quot;last&quot; : function(c){
+                return c[c.length-1] || [];
+            },
+
+            &quot;has&quot; : function(c, ss){
+                var s = Ext.DomQuery.select,
+                    r = [], ri = -1;
+                for(var i = 0, ci; ci = c[i]; i++){
+                    if(s(ss, ci).length &gt; 0){
+                        r[++ri] = ci;
+                    }
+                }
+                return r;
+            },
+
+            &quot;next&quot; : function(c, ss){
+                var is = Ext.DomQuery.is,
+                    r = [], ri = -1;
+                for(var i = 0, ci; ci = c[i]; i++){
+                    var n = next(ci);
+                    if(n &amp;&amp; is(n, ss)){
+                        r[++ri] = ci;
+                    }
+                }
+                return r;
+            },
+
+            &quot;prev&quot; : function(c, ss){
+                var is = Ext.DomQuery.is,
+                    r = [], ri = -1;
+                for(var i = 0, ci; ci = c[i]; i++){
+                    var n = prev(ci);
+                    if(n &amp;&amp; is(n, ss)){
+                        r[++ri] = ci;
+                    }
+                }
+                return r;
+            }
+        }
+    };
+}();
+
+<span id='Ext-method-query'>/**
+</span> * Selects an array of DOM nodes by CSS/XPath selector. Shorthand of {@link Ext.DomQuery#select}
+ * @param {String} path The selector/xpath query
+ * @param {Node} root (optional) The start of the query (defaults to document).
+ * @return {Array}
+ * @member Ext
+ * @method query
+ */
+Ext.query = Ext.DomQuery.select;
+</pre>
+</body>
+</html>