I found this article via Ajaxian regarding a nice block of Prototype updates.
- Shorter syntax for event handling
$('element').observe('click', function(e) { alert(e); }); - Make destructive Element, Form, and Form.Element methods return their first argument, so that multiple calls can be chained together.
$(“sidebar”).addClassName(“selected”).show();
The following methods now return their first argument: Element.toggle, Element.hide, Element.show, Element.remove, Element.update, Element.replace, Element.addClassName, Element.removeClassName, Element.observe, Element.stopObserving, Element.cleanWhitespace, Element.scrollTo, Element.setStyle, Element.makePositioned, Element.undoPositioned, Element.makeClipping, Element.undoClipping, Form.reset, Form.disable, Form.enable, Form.focusFirstElement, Form.Element.focus, Form.Element.select, Form.Element.clear, Form.Element.activate, Form.Element.disable, Form.Element.enable.
- Form and Form.Element methods mixed in to $ and $$
- For consistency, Element.toggle, Element.show, and Element.hide no longer take an arbitrary number of arguments.
!! BACKWARDS COMPATIBILITY CHANGE !!
If you have code that looks like this: Element.show(‘page’, ‘sidebar’, ‘content’); You need to replace it with code like this: [‘page’, ‘sidebar’, ‘content’].each(Element.show);
- Mix in Form and Form.Element methods to forms and form field elements with $() and $$(). Closes #4448. [Dan Webb, sam]
- Add Object.clone
- Add Form.Element.disable and Form.Element.enable. Closes #4943.
- Field is now simply an alias for Form.Element.
- Add Element.Methods.getElementsByClassName and Element.Methods.getElementsBySelector. Closes #4669.
- Avoid race condition when stopping an Ajax.PeriodicalUpdater. Closes #4809.
- Improve support for synchronous requests. Closes #5916.
- Add serialization and observation support for input type=search. Closes #4096.
- Properly decode query components in String.prototype.toQueryParams. Closes #3487.
- Add Array.prototype.reduce:
- [1, 2].reduce() // [1, 2]
- [1].reduce() // 1]
- [].reduce() // undefined]
- Add Object.keys and Object.values
- Simulate non-GET/POST requests by POSTing with a _method parameter set to the actual verb
- Make Element.update() handle TABLE-related elements with the DOM API because of IE’s missing .innerHTML property on them
- Sync to script.aculo.us unittest.js library as of 2006/08/29
- Add additional unit tests to test/unit/dom.html for testing Element.update and $().update in various enviroments
- Prevent possible exceptions on unloading the page in IE
I’m psyched!