8dd59220b93d23f4ffffe48ec8d1e2736d796dc6
[roojs1] / docs / symbols / Roo.DomQuery.json
1 {
2   "name" : "Roo.DomQuery",
3   "augments" : [
4   ],
5   "desc" : "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).\n<p>\nDomQuery supports most of the <a href=\"http://www.w3.org/TR/2005/WD-css3-selectors-20051215/\">CSS3 selectors spec</a>, along with some custom selectors and basic XPath.</p>\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<h4>Element Selectors:</h4>\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<h4>Attribute Selectors:</h4>\n<p>The use of @ and quotes are optional. For example, div[@foo='bar'] is also a valid attribute selector.</p>\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> has an attribute \"foo\" that does not equal \"bar\"</li>\n</ul>\n<h4>Pseudo Classes:</h4>\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</ul>\n<h4>CSS Value Selectors:</h4>\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>",
6   "isSingleton" : true,
7   "isStatic" : false,
8   "isBuiltin" : false,
9   "memberOf" : "DomQuery",
10   "example" : "",
11   "deprecated" : "",
12   "since" : "",
13   "see" : "",
14   "params" : [
15   ],
16   "returns" : [
17   ],
18   "config" : [
19   ],
20   "methods" : [
21     {
22       "name" : "selectNumber",
23       "desc" : "Selects the value of a node, parsing integers and floats.",
24       "isStatic" : false,
25       "isConstructor" : false,
26       "isPrivate" : false,
27       "memberOf" : "Roo.DomQuery",
28       "example" : "",
29       "deprecated" : "",
30       "since" : "",
31       "see" : "",
32       "params" : [
33         {
34           "name" : "selector",
35           "type" : "String",
36           "desc" : "The selector/xpath query",
37           "isOptional" : false
38         },
39         {
40           "name" : "root",
41           "type" : "Node",
42           "desc" : "(optional) The start of the query (defaults to document).",
43           "isOptional" : false
44         },
45         {
46           "name" : "defaultValue",
47           "type" : "Number",
48           "desc" : "",
49           "isOptional" : false
50         }
51       ],
52       "returns" : [
53         {
54           "name" : "",
55           "type" : "Number",
56           "desc" : ""
57         }
58       ]
59     },
60     {
61       "name" : "is",
62       "desc" : "Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)",
63       "isStatic" : false,
64       "isConstructor" : false,
65       "isPrivate" : false,
66       "memberOf" : "Roo.DomQuery",
67       "example" : "",
68       "deprecated" : "",
69       "since" : "",
70       "see" : "",
71       "params" : [
72         {
73           "name" : "el",
74           "type" : "String/HTMLElement/Array",
75           "desc" : "An element id, element or array of elements",
76           "isOptional" : false
77         },
78         {
79           "name" : "selector",
80           "type" : "String",
81           "desc" : "The simple selector to test",
82           "isOptional" : false
83         }
84       ],
85       "returns" : [
86         {
87           "name" : "",
88           "type" : "Boolean",
89           "desc" : ""
90         }
91       ]
92     },
93     {
94       "name" : "selectValue",
95       "desc" : "Selects the value of a node, optionally replacing null with the defaultValue.",
96       "isStatic" : false,
97       "isConstructor" : false,
98       "isPrivate" : false,
99       "memberOf" : "Roo.DomQuery",
100       "example" : "",
101       "deprecated" : "",
102       "since" : "",
103       "see" : "",
104       "params" : [
105         {
106           "name" : "selector",
107           "type" : "String",
108           "desc" : "The selector/xpath query",
109           "isOptional" : false
110         },
111         {
112           "name" : "root",
113           "type" : "Node",
114           "desc" : "(optional) The start of the query (defaults to document).",
115           "isOptional" : false
116         },
117         {
118           "name" : "defaultValue",
119           "type" : "String",
120           "desc" : "",
121           "isOptional" : false
122         }
123       ],
124       "returns" : [
125       ]
126     },
127     {
128       "name" : "filter",
129       "desc" : "Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)",
130       "isStatic" : false,
131       "isConstructor" : false,
132       "isPrivate" : false,
133       "memberOf" : "Roo.DomQuery",
134       "example" : "",
135       "deprecated" : "",
136       "since" : "",
137       "see" : "",
138       "params" : [
139         {
140           "name" : "el",
141           "type" : "Array",
142           "desc" : "An array of elements to filter",
143           "isOptional" : false
144         },
145         {
146           "name" : "selector",
147           "type" : "String",
148           "desc" : "The simple selector to test",
149           "isOptional" : false
150         },
151         {
152           "name" : "nonMatches",
153           "type" : "Boolean",
154           "desc" : "If true, it returns the elements that DON'T match\nthe selector instead of the ones that match",
155           "isOptional" : false
156         }
157       ],
158       "returns" : [
159         {
160           "name" : "",
161           "type" : "Array",
162           "desc" : ""
163         }
164       ]
165     },
166     {
167       "name" : "select",
168       "desc" : "Selects a group of elements.",
169       "isStatic" : false,
170       "isConstructor" : false,
171       "isPrivate" : false,
172       "memberOf" : "Roo.DomQuery",
173       "example" : "",
174       "deprecated" : "",
175       "since" : "",
176       "see" : "",
177       "params" : [
178         {
179           "name" : "selector",
180           "type" : "String",
181           "desc" : "The selector/xpath query (can be a comma separated list of selectors)",
182           "isOptional" : false
183         },
184         {
185           "name" : "root",
186           "type" : "Node",
187           "desc" : "(optional) The start of the query (defaults to document).",
188           "isOptional" : false
189         }
190       ],
191       "returns" : [
192         {
193           "name" : "",
194           "type" : "Array",
195           "desc" : ""
196         }
197       ]
198     },
199     {
200       "name" : "selectNode",
201       "desc" : "Selects a single element.",
202       "isStatic" : false,
203       "isConstructor" : false,
204       "isPrivate" : false,
205       "memberOf" : "Roo.DomQuery",
206       "example" : "",
207       "deprecated" : "",
208       "since" : "",
209       "see" : "",
210       "params" : [
211         {
212           "name" : "selector",
213           "type" : "String",
214           "desc" : "The selector/xpath query",
215           "isOptional" : false
216         },
217         {
218           "name" : "root",
219           "type" : "Node",
220           "desc" : "(optional) The start of the query (defaults to document).",
221           "isOptional" : false
222         }
223       ],
224       "returns" : [
225         {
226           "name" : "",
227           "type" : "Element",
228           "desc" : ""
229         }
230       ]
231     },
232     {
233       "name" : "compile",
234       "desc" : "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.",
235       "isStatic" : false,
236       "isConstructor" : false,
237       "isPrivate" : false,
238       "memberOf" : "Roo.DomQuery",
239       "example" : "",
240       "deprecated" : "",
241       "since" : "",
242       "see" : "",
243       "params" : [
244         {
245           "name" : "selector",
246           "type" : "String",
247           "desc" : "The selector/xpath query",
248           "isOptional" : false
249         },
250         {
251           "name" : "type",
252           "type" : "String",
253           "desc" : "(optional) Either \"select\" (the default) or \"simple\" for a simple selector match",
254           "isOptional" : false
255         }
256       ],
257       "returns" : [
258         {
259           "name" : "",
260           "type" : "Function",
261           "desc" : ""
262         }
263       ]
264     }
265   ],
266   "events" : [
267   ]
268 }