JQuery (for those of you just landed from Mars) is an unobtrusive javascript framework. read more at the JQuery home page.
jQuery supports Behavior driven development and is based on traversing HTML documents by CSS Selectors.
vs.
Prototype,
Prototype is also JavaScript library for Class driven development which makes life easier working with JavaScript. Prototype library has a good support in Ruby on Rails via helper functions and is basically well embedded in.
i decided to try to match both of these libraries (and dojo for the matter of fact, but the project was halted), and here are my conclusions.
- BDD
JQuery is very similar to CSS by assigning the HTML element behaviour out-side the HTML, so it is generally more adequate for MVC.
for ex:
$(element).click(function() {
alert("warning");
});
simple. - Chaining
Chining methods is as simple as ruby. period - CSS Selectors
Since JQuery is based upon CSS, you can access any element by it's CSS path, and avoid these annoying pesky ID's you have to put using Prototype.
for some more comparisons, visit the Ajaxian article
Finally:
Jquery and prototype are both great. For me, i prefer JQuery since it's approach appeals to me more than Prototype's, Although prototype is kinda Rubish and has inbound support from Rails, JQuery is still cleaner to me.
Did someone said JQuery to Rails integration?
0 comments:
Post a Comment