Which sums it up nicely I thought. I've heard of it in the past and always been a bit dubious, as I am with most code libraries of this kind. Sometimes they tend to be all-encompassing, bloated files. Prototype however is fairly slender at forty-something KBs and not too much of a burden on the page load.
Anyway, last week I had cause to use Ajax again and this time I wanted to make sure I was doing it the right/best way. Prototype.js seemed to be the way to go. If it's good enough for Rails it's good enough for me.
At first I thought I'd use the library just for making Ajax calls. However, I soon found myself using other parts of it to make the rest of my coding a lot simpler and slicker. I then went on to update the Ajax @DBLookup database to use Prototype.js. Take a look at the source code for that Form. Lots of weird and wonderful code, like this:
var server = $F('Server')
Which is a shortcut to this:
var server = document.forms.Server.value
And it works for dropdowns too, where it would be a shortcut for:
You can read all about how it works on this help page.
As I said it also makes Ajax a doddle too. Download the new updated DBLookup db to see how it in use and some Ajax tricks to boot.
What are the downsides? Well, the most obvious is the 40kb over-head. This though I think can be cut down by using only certain modules. What's 40k nowadays though? Not something I'd lose sleep over. The only other downside I can think of is how well the code will be adopted by future developers. To them it won't make any sense at all and comments in the code would probably have to alert them to the use of the library. Apart from that though it's a great way to make coding less hassle.