well, originally i chose JQuery, which seems too-awesome-to-ignore at the time, but a recent project made me decide to try Mootools once again, well, it's amazing.
MochaUI is an excellent UI library in Mootools, the simplicity is overwhelming and on top of it all the dynamic pseudo selectors as lately mentioned in David Walsh's blog... amazing.
/* grab "checked" elements */
Selectors.Pseudo.checked = function() {
return ('input' == this.get('tag') && ('radio' == this.get('type') || 'checkbox' == this.get('type')) && this.checked);
};
/* grab "selected" option elements */
Selectors.Pseudo.selected = function() {
return ('option' == this.get('tag') && this.selected);
};
/* grab random elements */
/* credit: http://blog.kassens.net/custom-pseudo-selectors */
Selectors.Pseudo.random = function(probability, local) {
return Math.random() < (probability || .5).toFloat();
};
/* grab elements with no value */
Selectors.Pseudo.noValue = function() {
return '' === this.value;
}
/* grab elements with a specific empty attribute */
Selectors.Pseudo.emptyAttribute = function(att) {
return this.get(att) == '';
}
i think i might have some second thoughts about JQuery..
2 comments:
December 15, 2008 at 5:40 PM
MooTools is much richer than jQuery in my opinion.
However, you can do the same pseudo selectors in jQuery too.
Look at:
http://ajaxian.com/archives/extending-jquery-selectors-with-javascript
http://james.padolsey.com/javascript/extending-jquerys-selector-capabilities/
December 16, 2008 at 12:58 PM
nice to know, didn't check it up yet (tangled up with mootools as the current project, maybe next time).
Post a Comment