Prototype 1.6.0, script.aculo.us 1.8.0, and the Bungee book now available
The final versions of Prototype 1.6.0, script.aculo.us 1.8.0, and the Prototype & script.aculo.us book are now available. Prototype 1.6.0 is the most significant update to the framework since its inception over two years ago. We’re very excited about the changes in this release, and what better way to celebrate than with an update to script.aculo.us and a book covering all the new goodness?
Prototype 1.6.0 released
This version of Prototype brings a number of major enhancements to the core APIs as well as the usual slew of bug fixes and performance optimizations. For the full story, see the CHANGELOG and the release notes for 1.6.0_rc0 and 1.6.0_rc1. API highlights include:
- Ajax transport objects are now automatically wrapped in an Ajax.Response object.
- Ajax.Response includes support for accessing JSON response bodies as JavaScript objects via the responseJSON property.
- The class API now includes full support for inheritance and superclass method calls. (See Mislav’s tutorial for more info.)
- Class objects now have an addMethods method for adding instance methods after creation.
- Elements can be created easily with the new Element(...) syntax.
- Element#insert provides a unified API to DOM element and HTML fragment insertion.
- Element#select is an alias for getElementsBySelector and is now the preferred way to find elements by class name.
- Element#wrap lets you easily wrap an element inside another element in place.
- Enumerable methods on Array are now backed by native Array#forEach implementations when possible.
- Enumerable now has aliases for equivalent JavaScript 1.6 Array methods, and support for JavaScript 1.6’s context parameter for automatic callback binding.
- Enumerable#grep now calls the match method on its first argument, so you can use it to e.g. filter an array of DOM nodes by CSS selector.
- Event objects are now automatically extended with instance methods, so you can write e.g. event.stop() instead of Event.stop(event).
- Prototype’s event API now supports firing DOM-based custom events with Element#fire.
- The new dom:loaded custom event fires when the entire document has loaded and is ready for manipulation.
- Function#curry allows for partial application of function arguments.
- Function#wrap facilitates simple aspect-oriented programming and provides the basis for Prototype’s superclass method call mechanism.
- Function#delay delays invocation of the function by the given number of seconds.
- Function#defer schedules the function to run as soon as the interpreter is idle.
- The Hash API has changed, and you must now use Hash#get and Hash#set instead of directly accessing properties on Hash instances.
- String#interpolate is a shortcut for instantiating a Template from the string and calling evaluate on it.
- Object properties can now be used in template replacement strings.
script.aculo.us 1.8.0 released
script.aculo.us 1.8.0 is fully compatible with Prototype 1.6.0 and includes several improvements since the last version; see the announcement on Thomas’ blog for more details. Here’s what’s new:
- Complete rewrite of the in-place editing controls.
- Full CSS inheritance support for Effect.Morph.
- Support for tweening between two values of an element property or method call with Effect.Tween.
- A new sound API for playing interface sound effect MP3s.
- Numerous bug fixes and performance improvements.
Prototype & script.aculo.us available in PDF
Core contributor Christophe Porteneuve’s book Prototype & script.aculo.us is now available for purchase from the Pragmatic Programmers. The “Bungee book” covers the final versions Prototype 1.6.0 and script.aculo.us 1.8.0, which is no small feat, considering many of the documented features were added in the five months since the book first went beta! You can get the final PDF instantly for $22; paper copies are $34.95 and will be shipping in the next few weeks. Every developer using Prototype and script.aculo.us will want to read this book.
One more thing…
I’m pleased to announce that Andrew Dupont and Tobie Langel now have commit privileges for Prototype trunk. They’ve contributed an abundance of good judgment in the form of patches and community interaction since the core team was formed in January, and I know they’ll be good keepers of the code. Welcome, Andrew and Tobie!
Download, report bugs, and get help
- Download Prototype 1.6.0
- Submit bug reports to Rails Trac
- Get Prototype help on the rails-spinoffs mailing list or #prototype IRC channel
- Interact with the Core Team on the prototype-core mailing list
As always, thanks to the core team and the many contributors responsible for making this release possible.
Sorry, comments are closed for this article.


Comments
Will the new Prototype and script.aculo.us make it into Rails 2.0?
Aleksandr- Yes, Prototype 1.6.0 and script.aculo.us 1.8.0 have been checked into Rails trunk and will be included with Rails 2.0.
Congrats core for a super release. JavaScript at its best! Can’t wait what you have up your sleeve for 2.0.
Sam Stephenson – thx for the update, this is the second greatest news of the day. Congrats everyone and time to crack open beers and cheer for the entire web dev community.
@Simon: out of curiosity, what was the first one ? ;)
Great job keeping our favorite library always surprising us.
when update the AIPDocs to 1.6
@Kane: we’re in the process of doing so. In the meantime, Christophe’s book is fully up to date.
Thanks to the hardworking team! Your swiftness is amazing!
Well done and thanks, Sam, Andrew and Tobie. The enhancements look very cool – I’ll be upgrading my app today.
There’s some great new functionality here and I guess we shouldn’t be surprised the file size is up 30%. Can we look forward to a minified version?
you guys rule.
bows downThis may be a stupid question, but does any packed version exist? Prototype is full of nice features, but also BIG. I love minified versions of jQuery :-)
@Láďa: We recommend using gzip, which should be an option with your webserver software.
Thanks to everyone who contributed. Prototype and Scriptaculous are the perfect basis set for building libraries and applications on. Look forward to using the new stuff! Will the help pages be updated soon, or at least tagged to say which are depreciated?
Excellent. Truly, I appreciate all of your hard work.
I’ve been resisting upgrading from 1.6rc0 because of the new Hash implementation, but out of curiosity I downloaded the final and ran a diff against it.
Of all the things that could motivate me to upgrade, I never thought it would be this tiny tidbit of JavaScript genius that is the optimisation to the String#times function:
Old: New: Damn that’s sexy.@Daniel: We’re working on the documentation as fast as we can.
@Conan: Martin Ström has to be credited for that one. And I agree, it is really sexy.
This won’t work:
var myhash = $({display: none}); $(element).setStyle(myhash);
The problem is the new Hash-Class! The loop inside the setStyle function will loop over all attributes and functions of the hash like ‘toJson’ function and so on. Please check it!
Because i needed a workaround, i had change the function setStyle in line 1920 to:
when will be availible offline (pdf) documentation on version 1.6?
@Lars: why not simply:
@darkie: We’ll ping Josh Clark as soon as we’re finished documenting the changes.
Yeah I know, this is just an other unproductive congrats post but thanks to all of you guys for this 1.6.0 final release! Definitely my favourite library.
I am not sure if this has been discussed before but as I build more and more libraries using prototype and am faced with client api’s and such, I am wondering why prototype isn’t name-spaced or at least gives an option to do so?
Thanks
Kevin
I just took a look at the new version and i am pretty impressed with the changes so far, thanks for all the work you put in because prototype js has been a real help and time save with my work.
Thank you.
Check out my performance tests of Prototype vs jQuery (yes, you’re faster, don’t worry ;-))
http://blog.solnic.in5.pl/2007/11/11/jquery-vs-prototype-part-i
This library is incredible.. I’ll use it till the end, whatever that may be.
It is getting huge, though. I’m a big fan of the YUI compressor. Here’s v.1.6 packed to about 72k with it:
http://prototypejs-packed.googlecode.com/files/prototype-packed.js
I’ve tested it and haven’t come across any problems… though, I’ve never had anything break using YUI.
Where could I find a state of the compatibility between this latest version and old browsers (guessing that prototype is fully compatible with up to date browsers)
@pvk: right here
Congratulations on completing 1.6.
I must ask though, why is prototype still not “packer” safe? Every time I download a new version I take 20 minutes to fix up semicolons by running JavaScript lint via Andrew Dupont’s own TextMate bundle here:
http://www.andrewdupont.net/2006/10/01/javascript-tools-textmate-bundle/
Hopefully with Andrew on board now, this will be fixed up soon. Since these fixes are scattered throughout the whole library it seems like something more appropriate for the core team to fix :)
Thanks again though for helping to make JavaScript a serious development language!
I love this library. Having a small problem – ANY HELP APPRECIATED. Since upgrading from 1.5.1 to 1.6.0 the live search script that I am running no longer works. I haven’t been able to figure it out. The site is http://www.vancesmith.net. I am getting an error:
Ajax.Search is not a constructor (no name)()foto-gallery (line 22) wrapper(load )prototype.js (line 3842) [Break on this error] input: ’s’
I am not sure how to adapt my code to work with the 1.6.0 prototype.
Something fishy in indexOf()... You end up getting ‘Not Found’ always even if elem.getValue() would be 2, which is in array below. Only thing that I can think of helping here is Math.abs(elem.getValue()) which corrects the situation but the usual (don’t select things with id<0>
I had applied Prototype 1.6.0 for getting fading effect in text style.But seems to be loading of site slow, when i included this version.
And if i included the previous version, there is no problem with loading.But my fading effect will not work with previous versions.
The changes are not in live site, but i tested things….
@Leland, nemec, Jithesh pk: Please seek support through our mailing list. Thank you.
It’s still sending the whole hash object on ajax requests (can be checked on GET). I patched it as:
Also, on Explorer specific implementation, it’s missing the stripTags:
@PDan: Could you kindly open tickets for those issues. Thank you!
About the Bungie book…
IMHO, it is lacking. I bought it thinking of it as my go to resource for any Prototype/Scriptaculous issue and let me warn you guys. The book is bloated with HTML/CSS and Ruby code, which is necessary in the book context and style, but I’ve read other books that doesn’t need that much. Also, If you think you are not going to need the online Prototype API (since it is outdated maybe on purpose to make people buy the book,) wrong, the book IS NOT an API replacement nor contains anything similar to it.
The author, I’m afraid, is biased towards the ruby platform and I’m sure that 75% of the people buying the book doesn’t have an idea of any Ruby code (me included, and still doesn’t personally know anyone using it.) I’m a java and c# developer. A little bit of abstraction on the server side code would have been nice.
The book is 500+ pages, but maybe 30% percent of them are dedicated to Ruby code, CSS, and HTML.
On the bright side: it IS a first… and that is a big step. The lecture is not rigid, once you start reading you can’t stop (unless you hit some chunk of maybe undesirable code.) And, its scriptaculous section is better than anything out there.
Hope this help you guys. And remember, this is my opinion. I’m sure there are a lots of people out there that like the book better than I do.
@Raul: Just to clarify, the API is not outdated on purpose so people buy the book: no one in the Core Team except the author will profit from sales.
We’re working on covering the API changes as fast as possible, but it’s a lot of work. Large sections have already been updated and the rest will follow asap.
Thanks for a fantastic framework. I thought the Bungee book was pretty good (although I’m familiar only with the early PDF version).
Is there a reason the Opera browser is not supported or atleast not listed as supported? If there is such a reason, what is it? Just curious.
@fearphage: We test on Opera 9 just like we test on other major browsers, but we don’t require that all unit tests pass in Opera before a release. In practice this is a lot like Yahoo’s graded browser support: Opera is treated as a C-grade browser. We make sure stuff works in Opera, but it doesn’t have to work perfectly. A handful of tests fail in Opera, but most of them are minor things (like small discrepancies in pixel values).
The reason why has to do with market share and the realities of software development schedules. Opera’s a lower priority because fewer people use it. (On a personal note: I wrote most of the Selector enhancements for 1.5.1, so I’m a huge fan of Opera’s JS engine and its lightning-fast implementation of DOM L3 XPath.)
That said, we happily accept bug reports and/or patches against Opera, and may move toward more complete support of Opera in future releases.
I too bought the Bungee book, but I’ve been happy with it so far, although I do have the same comments as Raul. It’s a great way to get into using Prototype, and to explore a bunch of stuff you might not have noticed before. It’s well-written and easy to read, and as such is much easier to get started with than reading the source code.
But yeah, there’s too much CSS and Ruby, but I think it’s just an irritation and not a deal-breaker. In the AJAX chapter, the first example contains 4.5 pages of Ruby and HTML, then a page of Javascript, most of which involves Scriptaculous which is covered much later in the book. Then, one line of actual Ajax.Request code. Huh? It doesn’t help you understand how the Ajax.Request object works, which is the point of the chapter.
But whatever, it was still worth it for me and it’s definitely getting me excited about using Prototype. That, and the scripteka repository.
i opened a ticket for element.fire no longer triggers when used with frames.
see http://dev.rubyonrails.org/ticket/10210
cheers
kai
@Kai: As of Prototype 1.6.0rc_1, custom events need to be namespaced. For example:
document.fire("widget:activated”);.From the code you posted inside the ticket, I suspect that’s the reason you’re having issues.
If it’s not, and if it appears to be an iframe related problem, please feel free to reopen that ticket.
This doesn’t seem to work anymore:
document.observe(“contentloaded”, function() { console.log(“HI”) });
Is this expected? How can I fix it?
Hi Alex,
As I just mentioned above, custom events are now namespaced, so you’ll need to listen to
"dom:loaded"instead of“contentloaded”.how use a property like outerHTML???
@choncon:
outerHTMLis a Microsoft proprietary property and is not part of Prototype.Hi guys,
I just noticed a bug(ish) with the symfony form checkbox generator and prototype.
Symfony creates a value option with the checkbox, which means prototypes $F(el) function (getValue) returns the value instead of the typical “on”...
The idea is that you should be able to use the array[] like a radio set, and have multiple options turned on. I’m not sure if that’s supported by 1.6, but if you only have one element, it doesn’t return the correct value.
Just a heads up.
the new Hash API (get and set) makes it impossible for us to update our projects to the new version… :(
awesome
my english is poor so i can’t descripe my feeling when get the relatest release.what i can say is thanks
You’ve already received praise for the new software. I would also like to congratulate you on your associated documention. Highlights are to the point, the release notes are comprehensive but in easily understood English. Sure the remaining documention is up to the same standard. Well done!!
I’m currently testing the 1.6.0 version but the list of improvements looks really great. The enhancement of APIs is what I’ve been waiting for. Keep up the good and fast work!
I get this error:
too much recursion:
prototype.js: line 1914 var elementStyle = element.style, match;
Any idea?
Here’s a poor-man’s function profiler you can use with any function, taking advantage of Function.wrap and Function.curry…
// Profile any function. Usage: // targetFunction = targetFunction.wrap(profile.curry(“targetFunction”)); function profile(label, base) { var args = $A(arguments); args.splice(0, 2); }
Let me try that again, with proper formatting.
Here’s a poor-man’s javascript function profiler using Function.wrap and Function.curry…
I would enjoy some PhD examples. (PhD = Push here, Dummy!) Or even better, several web pages with Ajax working. Novices, like me, can see the library in action and that’s how “I” personally learn the easiest.
Hope y’all can help.
Frederick
Frederick,
I suggest looking at the demos on the Scriptaculous site or if you really have an appetite take a look at sites built on Ext (http://extjs.com/). Thanks to prototype.js et al Ajax per se is a no brainer. Applications that use Ajax for all content changes are similar in some ways to SDI Windows apps.
have fun! Gerry
Prototype is just perfect, this 1.6 just rocks!