Css Query related function and Element extensions
MIT-style license.
| Dom.js | Css Query related function and Element extensions |
| Utility Functions | |
| Functions | |
| $E | Selects a single (i.e. |
| $ES | Returns a collection of Elements that match the selector passed in limited to the scope of the optional filter. |
| Element | Custom class to allow all of its methods to be used with any DOM element via the dollar function $. |
| Properties | |
| getElements | Gets all the elements within an element that match the given (single) selector. |
| getElementById | Targets an element with the specified id found inside the Element. |
| getElement | Same as Element.getElements, but returns only the first. |
| getElementsBySelector | Same as Element.getElements, but allows for comma separated selectors, as in css. |
| document related functions | |
| Functions | |
| document. getElementsByClassName | Returns all the elements that match a specific class name. |
| Elements | Methods for dom queries arrays, $$. |
function $E( selector, filter )
Selects a single (i.e. the first found) Element based on the selector passed in and an optional filter element.
| selector | the css selector to match |
| filter | optional; a DOM element to limit the scope of the selector match; defaults to document. |
$E('a', 'myElement') //find the first anchor tag inside the DOM element with id 'myElement'| a DOM element | the first element that matches the selector |
function $ES( selector, filter )
Returns a collection of Elements that match the selector passed in limited to the scope of the optional filter. See Also: Element.getElements for an alternate syntax.
an array of dom elements that match the selector within the filter
| selector | css selector to match |
| filter | optional; a DOM element to limit the scope of the selector match; defaults to document. |
$ES("a") //gets all the anchor tags; synonymous with $$("a")
$ES('a','myElement') //get all the anchor tags within $('myElement')Custom class to allow all of its methods to be used with any DOM element via the dollar function $.
| Properties | |
| getElements | Gets all the elements within an element that match the given (single) selector. |
| getElementById | Targets an element with the specified id found inside the Element. |
| getElement | Same as Element.getElements, but returns only the first. |
| getElementsBySelector | Same as Element.getElements, but allows for comma separated selectors, as in css. |
Gets all the elements within an element that match the given (single) selector.
| selector | the css selector to match |
$('myElement').getElements('a'); // get all anchors within myElementSupports these operators in attribute selectors:
Xpath is used automatically for compliant browsers.
Targets an element with the specified id found inside the Element. Does not overwrite document.getElementById.
| id | the id of the element to find. |
Same as Element.getElements, but returns only the first. Alternate syntax for $E, where filter is the Element.
Same as Element.getElements, but allows for comma separated selectors, as in css. Alternate syntax for $$, where filter is the Element.
| Functions | |
| document. getElementsByClassName | Returns all the elements that match a specific class name. |
Returns all the elements that match a specific class name. Here for compatibility purposes. can also be written: document.getElements(‘.className’), or $$(‘.className’)
Methods for dom queries arrays, $$.
returns the element passed in with all the Element prototypes applied.
function $( el )
Selects a single (i.e.
function $E( selector, filter )
Returns a collection of Elements that match the selector passed in limited to the scope of the optional filter.
function $ES( selector, filter )
Selects, and extends DOM elements.
function $$()