JQuery vs Prototype
| jQuery | Prototype | |
|---|---|---|
|
VS
|
|
| http://jquery.com | http://www.prototypejs.org |
jQuery and Prototype are cross-browser Javascript frameworks that allows Javascript programmers to program with ease and portability. Prototype features a standard Object-Oriented programming layout, whereas jQuery attempts to provide a more declarative API.
Contents |
[edit] Feel
Prototype feels like an extension to the Javascript language, for instance, trying to simulate a class-based inheritance in JavaScript (JavaScript has no classes, as it is a prototype-based object oriented language). The extra methods are similarly named to Ruby equivalents, and so Ruby programmers often feel more comfortable using it. In fact, Ruby on Rails, a popular web development framework built on Ruby ships with Prototype by default.
jQuery has a completely different feel from Prototype as it makes use of Javascript's functional programming model to make a declarative and functional API. jQuery is strongly associated with unobtrusive programming techniques because of its design: programming in jQuery feels like you're attaching javascript behavior to CSS selectors. In fact, many jQuery plugins are actually created to overcome browser-incompatibilities with CSS and shortcomings in CSS in general.
[edit] Modularity
jQuery has a small core library that is roughly 155KB unminified. There are hundreds of jQuery plugins available, outside of the standard plugins.
Prototype also has a small core library that is roughly 140KB unminified. Prototype also has hundreds of plugins available.
[edit] Standard plugins
jQuery has a UI plugin extension called jQuery-UI that provides widgets and animations. jQuery-UI focuses more on widgets and element "behaviors"
Prototype has an animation library called Scriptaculous. Scriptaculous focuses more on animations.
[edit] Speed
Browsers process jQuery faster than Prototype.
[edit] Bulk
Both jQuery and Prototype are very light frameworks that have small core libraries.
[edit] Features
[edit] Selectors
Both jQuery and Prototype support advanced CSS and XPath selectors. This was probably the greatest revolution in Javascript programming, and has prompted CSS selectors to be implemented in the core Javascript language.
[edit] Live
This is a jQuery feature only: fExtending the concept of "behaviors" on elements, jQuery 1.4 comes with a live() method that allows users to apply behaviors to CSS selectors that will be applied to elements even when they created after the fact.
[edit] DOM
Both jQuery and Prototype allows access to DOM elements through the $() method. The DOM elements are wrapped in both cases.
Prototype DOM wrappers act like DOM node objects themselves, whereas jQuery DOM wrappers act like accessors that manage the DOM nodes.
[edit] Animations
jQuery's core library does not come with animations, but jQuery-UI provides some animations.
Prototype itself does not come with animations, but Script.aculo.us, an animation library based on Prototype, provides a greater set of animations than jQuery-UI does.
[edit] Method Chains
jQuery allows rapid programming through method chains whereas Prototype provides similar functionality through bind().

