Critical Look at Prototype JS

Prototype.js != $(). I’ve been thinking about other JS libraries lately, like Moo, jQuery, and Dojo. (jQuery and Dojo both use WordPress for their blogs.) We need to make a final final decision about what JS framework we’re going to stick to for a year or more before we release WP 2.1.

33 replies on “Critical Look at Prototype JS”

I’d seriously consider Yahoo’s: they respect JavaScript as a language (i.e. it doesn’t add overhead trying to be something else), it has plenty of support & documentation, and they’ve mentioned something about accessibility. They also have to worry about performance and cross browser compatibility a lot, which is great from a developer’s point of view.

Chris Heilmann did a good post about JavaScript libraries recently.

I think that Moo is awesome. I like the fact that you can customize it to your needs so you don’t need to have this large file. Although, I think it’s a little to late for a switch in 2.1, but maybe 2.2 when/if there is a theme change. The theme could utilize the new framework. I never used Dojo before, but I used jQuery with a Vanilla install and it works superbly.

Wait a year or more, aww, that would be painful to wait for the auto save feature. 🙁
Personally I haven’t use any of those frameworks because I write my own, as the article recommends.

It completely depends on the use. As the article you’ve linked shows us, many of the functions Prototype offers aren’t used, and with good reason. Prototype was never meant to be used in frivolous coding. It was written to help making furthur libraries and extensions easier to code.

Also, you really don’t need Prototype. You can write almost all those functions yourself, and tinker tanker them to suit your needs. You just need to weigh out how much of Prototype you’ll actually use!

I think you should think about two things about libraries

1-Size of the js file.
2-Unnecessary functions

and also think about the plugins using these libraries. They shoud try to include the same js to the blog.

My choice is Moo. It is small and you select the tool you need from its page.

Dude, I got a catch-22: My experience tells me that Dojo is too heavy for serious use, although the best one. Moo would be my choice. It’s lightweight, but not as rich as Dojo.

Moo is nice and funny, but including 10 files (moostuff, moodom, mooajax and mooneighbours) is counter productive (10 http requests for 60 kb is way worse than 1 request for the same size)

For the javascript amateur that I am, Dojo seems just too complicated.

Remain jQuery & Prototype… I’m not going to shout any fanboy argument for one or another package, but just that since WP has been using Prototype for a few months yet, why change now ?

I cannot say enough nice things about jQuery. The library itself, the documentation, the community support… everything’s brilliant. It makes my life better every day.

I can only speak as a lowly designer, and not one who is very competant with javascript. But, I have enjoyed using mootools. For me, being able to morph elements by using familiar CSS tags/elements makes it a bit easier. Often times, I can see what a function does just by looking at it (which, to a designer with zero javascript books on my shelf, is nice). The reason I mention this, is that people like me who are decent at XHTML and CSS might be a little less intimidated by mootools when it comes to developing templates and such. But again, I haven’t used jQuety of Dojo nearly as much, so maybe they are designer-friendly as well.

Being a Rails guy it behooves you to use Prototype/Scriptaculous, but I keep thinking that the YUI libraries are the smartest choice, because I’d like to think Yahoo has the resources to stay on top of cross-browser issues.

I agree that Prototype is a bit backwards in some of their approach, but it is very well written code. However, is quite good and it uses prototype. You may want to look at jQuery – written by John Resig, so you know it is good, although their API is changing too.
You definitely do not want bleeding edge and have WordPress suffer; you do want to support OpenAjax for the best of breed and to support the most open API.

We currently use Prototype and Scriptaculous for most of our internal code but none of it is too crazy to make porting before a release terribly difficult, especially if someone knows the framework well.

After 2.1 ships, though, we really shouldn’t rock that boat for at least a year, which is why we should give the framework some pretty careful thought and examination before shipping.

I most say Moo (slows everythings down big time, sucks). Prototype yeah this one is groving strong strong and rails system use this one to (best of almost anything out there). jQuety can’t say anything bad about it but damn good love this baby kinda kinky. YUI is good to but i think you really should dig into this before you do anything with it, ok yahoo building something good but times has to tell if this really is as good as you think it’s.

Take a good look at jQuery!

1.1 will be released on 14th January and brings some important new features, massive selector speed improvements (which blow all other libraries out of the water) and an API clean-up.

When you start with 1.1, you have a stable, fast and small (1 file, lt 20kb) library at your disposal.

And there are already a ton of plugins to choose from, which could be packaged as wordpress plugins.

Hi Matt. While I think Dojo is a far superior and more complete (built-in widgets) solution, Prototype is really the best option in my opinion. JQuery is also really good but 2.1 is coming out soon and it’s not going to be backwards compatible.

I’ll agree with Ozh’s comments above about Prototype. Since it’s been included in the core of WP, I know several plugins that are already using it. I am currently using Prototype with (and some Rico) in production apps and it really works great. Size is not that big an issue as Prototype shrinks really well with things like Dojo Shrinksafe. Prototype is also fairly OO and so you can trim out things that you don’t need from the js file. I know Moo used to ship with a prototype.lite.js before the latest iteration of Mootools came out. My vote would be for Prototype but JQuery would be an excellent choice as well. Good luck.

I’d prefer YUI too, for its documentation and strong base. Please don’t choose depending on the amount of js files to include, a preprocessor can take take of that and compress all whitespace out of existence.

Two months ago I released a wordpress theme that contains an very efficent AJAX implimentation. Take a look here:

Commenting, page loading, instant search, preloading Only with an minimal Javascript (4.2KB, gzip compressed 1.2KB) and a simple PHP backend. It does even contain a very smart browser side caching algorithm… (and is ofcourse backwards compatible with non javascript clients)

The AJAX implementation is explained here:

And the reason why I didn’t use any library:

I highly recommend jQuery after trying both jQuery and Prototype/Scriptaculous. The main factors in its favor are that it’s super lightweight and you can write remarkably elegant code with it. Remember that many WordPress blogs target people in parts of the world which have poor connectivity, so the lightweight part is very important. Right now I’m using jQuery in combination with Dean Edwards’ Base.js for doing inheritance. Development is a dream.

OTOH, if you want to go with the library with the most adherents, to encourage plugin development, I guess prototype is the most popular.

Well, I’m completely and totally biased, but I’ll say jQuery. It’s amazing, small and is extremely efficient!

I’ve also written a couple of plugins for it to add its functionality into any WordPress site, along with a Thickbox plugin. I’ll have to sort out compatibility issues with Prototype though.

Either way, the decision to include Prototype is bad and it shouldn’t be forced.

Please please please go with Moo. It is so light that it literally floats. And I disagree with Ozh. With the awesome build system @ , a single compressed js file can be built for use.
Prototype is far too advanced and heavy for everyday use!

When I first heard the news of Prototype’s inclusion into WP, that single factor made me decided against upgrading when 2.1 is eventually released. Prototype is just too heavy for most blogger’s use.

Ps. I am not, in any way, affiliated to any of the libraries or their developers. This is my opinion as a JS developer.

I would rather select the best module/componets after going through most, if not all the javascript libraries. As for example the accordian method and the table grid method implementation in prototype/rico is far simpler than that of yahoo.UI. Similarly prototypes $(),makes programming easy to digest. Well to some extent in all the languages we ponder,we choose our own flavour of choice.


I just stumbled on this article after searching for how I can remove Prototype.js from WordPress. Lol. Prototype is 75% of the initial page load time on my blog. Ick.

Oh yeah, and btw – you’re my hero. I’ve been following your work for several years now. Keep up the good work!

I have to be honest, I don’t think there’s much difference. I use JQuery and Protoype/Scriptaculous and I’ve looked a few others. I think they’re all pretty sweet, but no clear favorites. Think I’ll go with prototype because I like their API documentation the best, but I think I could go with any and be fine.

Hmm… quite informative, I think prototype.js covering most of the features and functionalities rather then some.

Also I have seen that the compatibility of prototype is much higher then other.