The root namespace for the Grail library.
- Source:
- maria.js, line 1064
Methods
-
<static> find(selector, root) → {Element}
-
Search for the first element matching the CSS selector. If the element is found then it is returned. If no matching element is found then null or undefined is returned.
The rest of the details are the same as for grail.findAll.
Parameters:
Name Type Argument Description selector
string <optional>
The CSS selector for the search.
root
Document | Element <optional>
The element to use as the search start point.
- Source:
- maria.js, line 1236
Returns:
The found
Element
.- Type
- Element
-
<static> findAll(selector, root) → {Array}
-
Search for all elements matching the CSS selector. Returns an array of the elements.
Acceptable simple selectors are of the following forms only.
div #alpha .beta div.gamma
In the case of a #myId selector, the returned array will always have zero or one elements. It is more likely that you want to call grail.find when using an id selector.
If the root element is supplied then it is used as the starting point for the search. The root element will be in the results if it matches the selector. If the root element is not supplied then the current document is used as the search starting point.
grail.findAll('#alpha'); grail.findAll('div.gamma', document.body);
Parameters:
Name Type Argument Description selector
string The CSS selector for the search.
root
Document | Element <optional>
The element to use as the search start point.
- Source:
- maria.js, line 1187
Returns:
An array of matching
Element
objects.- Type
- Array