File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Is Prototype simpler than jQuery? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Is Prototype simpler than jQuery?" Watch "Is Prototype simpler than jQuery?" New topic

Is Prototype simpler than jQuery?

Nikos Pougounias
Ranch Hand

Joined: Jan 16, 2008
Posts: 110
Hello, is Prototype simpler than jQuery?

Of course this is not a yes or no answer. Let's concentrate in the areas of syntax (e.g. chaining methods) and event handling model (cross-browser compliance).

Thank you

Nikos' Java blog
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63867

You're right; there is no yes/no answer.

Some might say that Prototype is simpler than jQuery because it invasively adds methods directly to the elements so that you simply call the methods given an element reference. Others would say that jQuery is simpler because the methods are all neatly packaged as methods of the wrapper object returned from applying a jQuery selector.

It could be said that jQuery is simpler because most statements follow a simple pattern of applying a jQuery selector and operating upon it with a jQuery method or chain of methods. Conversely, one might argue that Prototype just lets you write your statements any old way you like.

jQuery's powerful selectors let you pick and choose which elements you want to operate upon. Some say this makes jQuery easier because you can write less code to pick elements; others might argue that the selector syntax is something that needs to be learned.

A lot of "six of one".

With regards to chaining, jQuery has a very nice chaining model where methods that pass the wrapper through can be chained to make statements that perform multiple operations cleanly and simply.

The syntax for declaring and using event handling is different between the two libraries, but I'm not sure one could say that either is simpler or more difficult than the other.

Both libraries have their strengths and weaknesses, and it's nice that because of jQuery's design, both can be used on the same page, if that is deemed appropriate.
[ February 12, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Is Prototype simpler than jQuery?
It's not a secret anymore!