Wondering if anyone here can offer any insight into the ups/downs of using the RightJS library, specifically as compared to jQuery, and generally compared to what you think a library ought to offer.
I'm not so much looking for a feature to feature comparison, but rather a sense of the general daily use.
Things like:
- Does it feel natural to use, or does it feel like an uphill battle?
- Does the API express itself in a comprehensible manner, or do you find yourself wondering what the code you wrote 3 weeks ago means?
- Do you find yourself wishing it had some feature of jQuery (or some feature in general), or inversely, do you enjoy some particular feature that other libraries don't have?
- General philosophical considerations that you think make RightJS superior/inferior.
Not things like:
- Mindshare/marketshare/plugins/CDN/ considerations (the winner is obvious)
- Why would you bother... (moot)
- jQuery does x, y and z, and RightJS doesn't, without offering insight into how it impacts daily use (there could be philosophical reasons that make x, y and z unnecessary)
Based on the documentation, code samples, and what is already in the works for RightJS 2, I am very impressed.
@Patrick - Thanks for pointing out the Call By Name feature in RightJS which seems extremely useful for removing most anonymous functions from all over the page. For those who are not familiar with it, the idea is to specify the method name and arguments as parameters instead of creating an anonymous callback. For example, if we are trying to filter all words and phrased that begin with "hello" from an array,
Using the filter method on arrays, we would write:
We can write the same thing using Call By Name in RightJS as,
Pretty sweet eh?
I am also loving the idea of being able to use strings as selectors directly. Although RightJS only does it for event delegation at the moment, but I would love to be able to completely get rid of the
$
function for most purposes and directly call methods on a string. For example, to listen to all clicks on any para on the page, write:Or maybe combine this with Call By Name,
The things I am excited about in RightJS 2 is the ability to use widgets as native elements.
Thanks to @patrick and @Nikolay for clarifying my assumption here. The widget will wrap the native DOM element which is available as the
_
property on the object.or use the methods provided by the framework.
Another nice feature is a unified way to initialize widgets using just a declarative syntax:
instead of creating an object ourselves and then adding it to the page:
I have taken the slides from a presentation titled JavaScript Library Overview by John Resig and compared the code samples for jQuery with RightJS. These samples mainly compare the basic syntax for both frameworks which is more similar than different, although RightJS seems to be more flexible in its usage.
DOM Traversal
jQuery
RightJS
DOM Modification
jQuery
RightJS
Events
jQuery
RightJS
AJAX
jQuery
or
RightJS
or
Animations
jQuery
RightJS
Array traversal
jQuery
RightJS