Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / docs / output / Ext.DomQuery.js
1 Ext.data.JsonP.Ext_DomQuery({
2   "tagname": "class",
3   "name": "Ext.DomQuery",
4   "doc": "<p>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).</p>\n\n<p>\nDomQuery 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>\n\n\n\n\n<p>\nAll 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.\n</p>\n\n\n<h4>Element Selectors:</h4>\n\n\n<ul class=\"list\">\n    <li> <b>*</b> any element</li>\n    <li> <b>E</b> an element with the tag E</li>\n    <li> <b>E F</b> All descendent elements of E that have the tag F</li>\n    <li> <b>E > F</b> or <b>E/F</b> all direct children elements of E that have the tag F</li>\n    <li> <b>E + F</b> all elements with the tag F that are immediately preceded by an element with the tag E</li>\n    <li> <b>E ~ F</b> all elements with the tag F that are preceded by a sibling element with the tag E</li>\n</ul>\n\n\n<h4>Attribute Selectors:</h4>\n\n\n<p>The use of &#64; and quotes are optional. For example, div[&#64;foo='bar'] is also a valid attribute selector.</p>\n\n\n<ul class=\"list\">\n    <li> <b>E[foo]</b> has an attribute \"foo\"</li>\n    <li> <b>E[foo=bar]</b> has an attribute \"foo\" that equals \"bar\"</li>\n    <li> <b>E[foo^=bar]</b> has an attribute \"foo\" that starts with \"bar\"</li>\n    <li> <b>E[foo$=bar]</b> has an attribute \"foo\" that ends with \"bar\"</li>\n    <li> <b>E[foo*=bar]</b> has an attribute \"foo\" that contains the substring \"bar\"</li>\n    <li> <b>E[foo%=2]</b> has an attribute \"foo\" that is evenly divisible by 2</li>\n    <li> <b>E[foo!=bar]</b> attribute \"foo\" does not equal \"bar\"</li>\n</ul>\n\n\n<h4>Pseudo Classes:</h4>\n\n\n<ul class=\"list\">\n    <li> <b>E:first-child</b> E is the first child of its parent</li>\n    <li> <b>E:last-child</b> E is the last child of its parent</li>\n    <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>\n    <li> <b>E:nth-child(odd)</b> E is an odd child of its parent</li>\n    <li> <b>E:nth-child(even)</b> E is an even child of its parent</li>\n    <li> <b>E:only-child</b> E is the only child of its parent</li>\n    <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>\n    <li> <b>E:first</b> the first E in the resultset</li>\n    <li> <b>E:last</b> the last E in the resultset</li>\n    <li> <b>E:nth(<i>n</i>)</b> the <i>n</i>th E in the resultset (1 based)</li>\n    <li> <b>E:odd</b> shortcut for :nth-child(odd)</li>\n    <li> <b>E:even</b> shortcut for :nth-child(even)</li>\n    <li> <b>E:contains(foo)</b> E's innerHTML contains the substring \"foo\"</li>\n    <li> <b>E:nodeValue(foo)</b> E contains a textNode with a nodeValue that equals \"foo\"</li>\n    <li> <b>E:not(S)</b> an E element that does not match simple selector S</li>\n    <li> <b>E:has(S)</b> an E element that has a descendent that matches simple selector S</li>\n    <li> <b>E:next(S)</b> an E element whose next sibling matches simple selector S</li>\n    <li> <b>E:prev(S)</b> an E element whose previous sibling matches simple selector S</li>\n    <li> <b>E:any(S1|S2|S2)</b> an E element which matches any of the simple selectors S1, S2 or S3//\\\\</li>\n</ul>\n\n\n<h4>CSS Value Selectors:</h4>\n\n\n<ul class=\"list\">\n    <li> <b>E{display=none}</b> css value \"display\" that equals \"none\"</li>\n    <li> <b>E{display^=none}</b> css value \"display\" that starts with \"none\"</li>\n    <li> <b>E{display$=none}</b> css value \"display\" that ends with \"none\"</li>\n    <li> <b>E{display*=none}</b> css value \"display\" that contains the substring \"none\"</li>\n    <li> <b>E{display%=2}</b> css value \"display\" that is evenly divisible by 2</li>\n    <li> <b>E{display!=none}</b> css value \"display\" that does not equal \"none\"</li>\n</ul>\n\n",
5   "extends": null,
6   "mixins": [
7
8   ],
9   "alternateClassNames": [
10
11   ],
12   "xtype": null,
13   "author": null,
14   "docauthor": null,
15   "singleton": true,
16   "private": false,
17   "cfg": [
18
19   ],
20   "method": [
21     {
22       "tagname": "method",
23       "name": "compile",
24       "member": "Ext.DomQuery",
25       "doc": "<p>Compiles a selector/xpath query into a reusable function. The returned function\ntakes one parameter \"root\" (optional), which is the context node from where the query should start.</p>\n",
26       "params": [
27         {
28           "type": "String",
29           "name": "selector",
30           "doc": "<p>The selector/xpath query</p>\n",
31           "optional": false
32         },
33         {
34           "type": "String",
35           "name": "type",
36           "doc": "<p>(optional) Either \"select\" (the default) or \"simple\" for a simple selector match</p>\n",
37           "optional": true
38         }
39       ],
40       "return": {
41         "type": "Function",
42         "doc": "\n"
43       },
44       "private": false,
45       "static": false,
46       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/dom/DomQuery.js",
47       "linenr": 431,
48       "html_filename": "DomQuery.html",
49       "href": "DomQuery.html#Ext-DomQuery-method-compile",
50       "shortDoc": "Compiles a selector/xpath query into a reusable function. The returned function\ntakes one parameter \"root\" (optional)..."
51     },
52     {
53       "tagname": "method",
54       "name": "filter",
55       "member": "Ext.DomQuery",
56       "doc": "<p>Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)</p>\n",
57       "params": [
58         {
59           "type": "Array",
60           "name": "el",
61           "doc": "<p>An array of elements to filter</p>\n",
62           "optional": false
63         },
64         {
65           "type": "String",
66           "name": "selector",
67           "doc": "<p>The simple selector to test</p>\n",
68           "optional": false
69         },
70         {
71           "type": "Boolean",
72           "name": "nonMatches",
73           "doc": "<p>If true, it returns the elements that DON'T match\nthe selector instead of the ones that match</p>\n",
74           "optional": false
75         }
76       ],
77       "return": {
78         "type": "Array",
79         "doc": "<p>An Array of DOM elements which match the selector. If there are\nno matches, and empty Array is returned.</p>\n"
80       },
81       "private": false,
82       "static": false,
83       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/dom/DomQuery.js",
84       "linenr": 672,
85       "html_filename": "DomQuery.html",
86       "href": "DomQuery.html#Ext-DomQuery-method-filter",
87       "shortDoc": "<p>Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)</p>\n"
88     },
89     {
90       "tagname": "method",
91       "name": "is",
92       "member": "Ext.DomQuery",
93       "doc": "<p>Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)</p>\n",
94       "params": [
95         {
96           "type": "String/HTMLElement/Array",
97           "name": "el",
98           "doc": "<p>An element id, element or array of elements</p>\n",
99           "optional": false
100         },
101         {
102           "type": "String",
103           "name": "selector",
104           "doc": "<p>The simple selector to test</p>\n",
105           "optional": false
106         }
107       ],
108       "return": {
109         "type": "Boolean",
110         "doc": "\n"
111       },
112       "private": false,
113       "static": false,
114       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/dom/DomQuery.js",
115       "linenr": 657,
116       "html_filename": "DomQuery.html",
117       "href": "DomQuery.html#Ext-DomQuery-method-is",
118       "shortDoc": "<p>Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)</p>\n"
119     },
120     {
121       "tagname": "method",
122       "name": "jsSelect",
123       "member": "Ext.DomQuery",
124       "doc": "<p>Selects an array of DOM nodes using JavaScript-only implementation.</p>\n\n<p>Use <a href=\"#/api/Ext.DomQuery-method-select\" rel=\"Ext.DomQuery-method-select\" class=\"docClass\">select</a> to take advantage of browsers built-in support for CSS selectors.</p>\n",
125       "params": [
126         {
127           "type": "String",
128           "name": "selector",
129           "doc": "<p>The selector/xpath query (can be a comma separated list of selectors)</p>\n",
130           "optional": false
131         },
132         {
133           "type": "Node/String",
134           "name": "root",
135           "doc": "<p>(optional) The start of the query (defaults to document).</p>\n",
136           "optional": true
137         },
138         {
139           "type": "Object",
140           "name": "type",
141           "doc": "\n",
142           "optional": false
143         }
144       ],
145       "return": {
146         "type": "Array",
147         "doc": "<p>An Array of DOM elements which match the selector. If there are\nno matches, and empty Array is returned.</p>\n"
148       },
149       "private": false,
150       "static": false,
151       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/dom/DomQuery.js",
152       "linenr": 525,
153       "html_filename": "DomQuery.html",
154       "href": "DomQuery.html#Ext-DomQuery-method-jsSelect",
155       "shortDoc": "Selects an array of DOM nodes using JavaScript-only implementation.\n\nUse select to take advantage of browsers built-i..."
156     },
157     {
158       "tagname": "method",
159       "name": "select",
160       "member": "Ext.DomQuery",
161       "doc": "<p>Selects an array of DOM nodes by CSS/XPath selector.</p>\n\n<p>Uses <a href=\"https://developer.mozilla.org/en/DOM/document.querySelectorAll\">document.querySelectorAll</a> if browser supports that, otherwise falls back to\n<a href=\"#/api/Ext.DomQuery-method-jsSelect\" rel=\"Ext.DomQuery-method-jsSelect\" class=\"docClass\">jsSelect</a> to do the work.</p>\n\n<p>Aliased as <a href=\"#/api/Ext-method-query\" rel=\"Ext-method-query\" class=\"docClass\">Ext.query</a>.</p>\n",
162       "params": [
163         {
164           "type": "String",
165           "name": "path",
166           "doc": "<p>The selector/xpath query</p>\n",
167           "optional": false
168         },
169         {
170           "type": "Node",
171           "name": "root",
172           "doc": "<p>(optional) The start of the query (defaults to document).</p>\n",
173           "optional": true
174         }
175       ],
176       "return": {
177         "type": "Array",
178         "doc": "<p>An array of DOM elements (not a NodeList as returned by <code>querySelectorAll</code>).\nEmpty array when no matches.</p>\n"
179       },
180       "private": false,
181       "static": false,
182       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/dom/DomQuery.js",
183       "linenr": 580,
184       "html_filename": "DomQuery.html",
185       "href": "DomQuery.html#Ext-DomQuery-method-select",
186       "shortDoc": "Selects an array of DOM nodes by CSS/XPath selector.\n\nUses document.querySelectorAll if browser supports that, otherw..."
187     },
188     {
189       "tagname": "method",
190       "name": "selectNode",
191       "member": "Ext.DomQuery",
192       "doc": "<p>Selects a single element.</p>\n",
193       "params": [
194         {
195           "type": "String",
196           "name": "selector",
197           "doc": "<p>The selector/xpath query</p>\n",
198           "optional": false
199         },
200         {
201           "type": "Node",
202           "name": "root",
203           "doc": "<p>(optional) The start of the query (defaults to document).</p>\n",
204           "optional": true
205         }
206       ],
207       "return": {
208         "type": "Element",
209         "doc": "<p>The DOM element which matched the selector.</p>\n"
210       },
211       "private": false,
212       "static": false,
213       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/dom/DomQuery.js",
214       "linenr": 610,
215       "html_filename": "DomQuery.html",
216       "href": "DomQuery.html#Ext-DomQuery-method-selectNode",
217       "shortDoc": "<p>Selects a single element.</p>\n"
218     },
219     {
220       "tagname": "method",
221       "name": "selectNumber",
222       "member": "Ext.DomQuery",
223       "doc": "<p>Selects the value of a node, parsing integers and floats. Returns the defaultValue, or 0 if none is specified.</p>\n",
224       "params": [
225         {
226           "type": "String",
227           "name": "selector",
228           "doc": "<p>The selector/xpath query</p>\n",
229           "optional": false
230         },
231         {
232           "type": "Node",
233           "name": "root",
234           "doc": "<p>(optional) The start of the query (defaults to document).</p>\n",
235           "optional": true
236         },
237         {
238           "type": "Number",
239           "name": "defaultValue",
240           "doc": "\n",
241           "optional": false
242         }
243       ],
244       "return": {
245         "type": "Number",
246         "doc": "\n"
247       },
248       "private": false,
249       "static": false,
250       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/dom/DomQuery.js",
251       "linenr": 645,
252       "html_filename": "DomQuery.html",
253       "href": "DomQuery.html#Ext-DomQuery-method-selectNumber",
254       "shortDoc": "<p>Selects the value of a node, parsing integers and floats. Returns the defaultValue, or 0 if none is specified.</p>\n"
255     },
256     {
257       "tagname": "method",
258       "name": "selectValue",
259       "member": "Ext.DomQuery",
260       "doc": "<p>Selects the value of a node, optionally replacing null with the defaultValue.</p>\n",
261       "params": [
262         {
263           "type": "String",
264           "name": "selector",
265           "doc": "<p>The selector/xpath query</p>\n",
266           "optional": false
267         },
268         {
269           "type": "Node",
270           "name": "root",
271           "doc": "<p>(optional) The start of the query (defaults to document).</p>\n",
272           "optional": true
273         },
274         {
275           "type": "String",
276           "name": "defaultValue",
277           "doc": "\n",
278           "optional": false
279         }
280       ],
281       "return": {
282         "type": "String",
283         "doc": "\n"
284       },
285       "private": false,
286       "static": false,
287       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/dom/DomQuery.js",
288       "linenr": 620,
289       "html_filename": "DomQuery.html",
290       "href": "DomQuery.html#Ext-DomQuery-method-selectValue",
291       "shortDoc": "<p>Selects the value of a node, optionally replacing null with the defaultValue.</p>\n"
292     }
293   ],
294   "property": [
295     {
296       "tagname": "property",
297       "name": "matchers",
298       "member": "Ext.DomQuery",
299       "type": "Object",
300       "doc": "<p>Collection of matching regular expressions and code snippets.\nEach capture group within () will be replace the {} in the select\nstatement as specified by their index.</p>\n",
301       "private": false,
302       "static": false,
303       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/dom/DomQuery.js",
304       "linenr": 690,
305       "html_filename": "DomQuery.html",
306       "href": "DomQuery.html#Ext-DomQuery-property-matchers",
307       "shortDoc": "Collection of matching regular expressions and code snippets.\nEach capture group within () will be replace the {} in ..."
308     },
309     {
310       "tagname": "property",
311       "name": "operators",
312       "member": "Ext.DomQuery",
313       "type": "Object",
314       "doc": "<p>Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *=, %=, |= and ~=.\nNew 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;.</p>\n",
315       "private": false,
316       "static": false,
317       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/dom/DomQuery.js",
318       "linenr": 713,
319       "html_filename": "DomQuery.html",
320       "href": "DomQuery.html#Ext-DomQuery-property-operators",
321       "shortDoc": "Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *=, %=, |= and ~=.\nNew operator..."
322     },
323     {
324       "tagname": "property",
325       "name": "pseudos",
326       "member": "Ext.DomQuery",
327       "type": "Object",
328       "doc": "<p>Object hash of \"pseudo class\" filter functions which are used when filtering selections.\nEach function is passed two parameters:</p>\n\n<ul>\n<li><p><strong>c</strong> : Array\n  An Array of DOM elements to filter.</p></li>\n<li><p><strong>v</strong> : String\n  The argument (if any) supplied in the selector.</p></li>\n</ul>\n\n\n<p>A filter function returns an Array of DOM elements which conform to the pseudo class.\nIn addition to the provided pseudo classes listed above such as <code>first-child</code> and <code>nth-child</code>,\ndevelopers may add additional, custom psuedo class filters to select elements according to application-specific requirements.</p>\n\n<p>For example, to filter <code>a</code> elements to only return links to <strong>external</strong> resources:</p>\n\n<pre><code>Ext.DomQuery.pseudos.external = function(c, v){\n    var r = [], ri = -1;\n    for(var i = 0, ci; ci = c[i]; i++){\n        // Include in result set only if it's a link to an external resource\n        if(ci.hostname != location.hostname){\n            r[++ri] = ci;\n        }\n    }\n    return r;\n};\n</code></pre>\n\n<p>Then external links could be gathered with the following statement:</p>\n\n<pre><code>var externalLinks = Ext.select(\"a:external\");\n</code></pre>\n",
329       "private": false,
330       "static": false,
331       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/dom/DomQuery.js",
332       "linenr": 744,
333       "html_filename": "DomQuery.html",
334       "href": "DomQuery.html#Ext-DomQuery-property-pseudos",
335       "shortDoc": "Object hash of \"pseudo class\" filter functions which are used when filtering selections.\nEach function is passed two ..."
336     }
337   ],
338   "event": [
339
340   ],
341   "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/dom/DomQuery.js",
342   "linenr": 5,
343   "html_filename": "DomQuery.html",
344   "href": "DomQuery.html#Ext-DomQuery",
345   "cssVar": [
346
347   ],
348   "cssMixin": [
349
350   ],
351   "component": false,
352   "superclasses": [
353
354   ],
355   "subclasses": [
356
357   ],
358   "mixedInto": [
359
360   ],
361   "allMixins": [
362
363   ]
364 });