*SVN* * Ensure that classes always have an initialize method. [Mislav Marohnić] * Update Template, Selector, Ajax.*, and ObjectRange classes to use the new class system. [Mislav Marohnić] * Change Abstract.TimedObserver to subclass PeriodicalExecuter and tweak its subclasses to use new inheritance functionality. TimedObserver can now be stopped the same way as PeriodicalExecuter. Closes #8589. [Mislav Marohnić] * Fix Class.mixin to extend the class's prototype. [Mislav Marohnić] * Fix superclass method call breakage from [7337]. [Mislav Marohnić, sam] * Change Class.extend to allow for superclass method resolution and remove Class.inherit. Closes #9274. [Samuel Lebeau] * Event handlers are now bound to the observed element, not the event's target element. [Dan Webb] * Define Node constants conditionally after checking for Node.ELEMENT_NODE presence. Add unit test to check the values of all constants. Closes #7625. [Mislav Marohnić] * Make sure Enumerable#include doesn't do type comparision. [Mislav Marohnić] * Add contextmenu to Event.DOMEvents. [Thomas Fuchs] *1.6.0_rc0* (August 15, 2007) * Fix readAttribute-related failure in form.html in IE. [sam, Andrew Dupont] * Fix failing dom.html and selector.html tests in IE. [Tobie Langel, Andrew Dupont] * Make sure the WebKit redefinition of Element#cumulativeOffset uses Element._returnOffset. Closes #9245. [mdaines] * Make sure Element#observe and Element#stopObserving are always chainable. [sam] * Event.fire/Element#fire now returns the newly-fired event instead of the event's target element. [sam] * Restrict Event.DOMEvents to include only events that can be supported in all browsers. [sam] * Fix a failing test in base.html in Safari 2. [Tobie Langel] * Fix Element#positionedOffset and Element#getOffsetParent for static elements on IE. [Thomas Fuchs] * Make sure event handlers and their wrappers are removed from the cache by Event.stopObserving. [sam, Severin Heiniger] * Add line numbers to failures when unit testing in Firefox. Closes #9231. [John Resig] * Fix Function#argumentNames for Opera and IE. [Thomas Fuchs] * Add Object.isString, Object.isNumber, and Object.isUndefined, and clean up the source to make use of Object.isXXX where possible. [sam] * Add the document.viewport object for querying dimensions and scroll offsets of the browser viewport. [Andrew Dupont, Thomas Fuchs, sam] Example: document.viewport.getDimensions() // { width: 1149, height: 923 } document.viewport.getWidth() // 1149 document.viewport.getHeight() // 923 document.viewport.getScrollOffsets() // { left: 0, top: 1592 } * Add support for brackets in quoted attribute value selectors. Closes #9157. [Ken Snyder] * Add some missing semicolons to the source tree. Closes #9140. [jdalton] * Fix event extensions and custom events firing for Safari 2.0. [Thomas Fuchs] * Add RegExp.escape for escaping regular expression strings. Closes #9094. [Ken Snyder] * Make the eventName and handler arguments to Event.stopObserving optional. If no handler is specified, all handlers for the given event are unregistered. If no event name is specified, all observed events on the element are unregistered. [sam] * Add cross-support for the DOMContentLoaded event through a Prototype custom event on document called "contentloaded". The DOMContentLoaded event fires before window.load, when the entire HTML document, but not necessarily its images, stylesheets or other assets, has loaded. Based on [6596]. [sam, Mislav Marohnić] Example: document.observe("contentloaded", function() { $$("a").invoke("identify"); // give all tags an ID }); * Add Event.fire and Element.Methods.fire for firing custom events. Prototype custom events piggyback on a real DOM event ("ondataavailable"), so they bubble and cancel. You can fire custom events from any element, or fire global events on the document object. Observe custom events just as you'd observe a regular DOM event. [sam, Seth Dillingham] * Extend the event object with methods from Event.Methods and normalize it in IE. [sam, Mislav Marohnić] * Remove support for observing the capturing phase of DOM events, since we can't support it in all browsers. [sam] * Add Ajax.Response object which supports the following methods: responseJSON, headerJSON, getHeader, getAllHeaders and handles browser discrepancies in the other response methods. Add sanitizeJSON, evalJS and evalJSON to Ajax.Request. Closes #8122, #8006, #7295. [Tobie Langel] * Add an isRunningFromRake property to unit tests. [Tobie Langel] * Add support for Opera browser in jstest.rb. [Tobie Langel] * Inheritance branch merged to trunk; robust inheritance support for Class.create. Closes #5459. [Dean Edwards, Alex Arnell, Andrew Dupont, Mislav Mahronic] - To access a method's superclass method, add "$super" as the first argument. (The naming is significant.) Works like Function#wrap. - Class.create now takes two optional arguments. The first is an existing class to subclass; the second is an object literal defining the instance properties/methods. Either can be omitted. Backwards-compatible with old Class.create. - Added Class.extend for dynamically adding methods to existing classes (while preserving inheritance chain). Can also be used for mixins. - The 'constructor' property of a class instance always points back to the proper class. Class objects themselves have two special properties: 'superclass' and 'subclasses' (which default to 'null' and '[]', respectively). Allows for powerful introspection. - Added Object.isFunction [sam] * Add Function#argumentNames, which returns an ordered array of the function's named arguments. [sam] * Prevent a crash in Safari 1.3 on String#stripScripts and String#extractScripts. Closes #8332. [grant, Tobie Langel] * Add Prototype.Browser.MobileSafari which evaluates to true on the iPhone's browser. [sam] * Optimize Selector#match and Element#match for simple selectors. Closes #9082. [Andrew Dupont] * Remove the dependency on Element.ClassNames from Element#addClassName/removeClassName/toggleClassName, and deprecate Element.ClassNames. Closes #9073. [Tobie Langel] * Make Element#wrap accept a second argument for setting attributes on the wrapper. Allow wrapping elements which are not part of the document. Closes #9071. [Tobie Langel] * Improvements for Element#replace, Element#update and Element#insert. Closes #7429, #9060. [Tobie Langel] - Element#replace/update/insert uses the argument's toElement or toHTML method if present (toElement has precedence if both are present). - Element#replace and Element#update now also accept DOM elements. - Element#replace better handles table-related elements in IE and Opera. * Add Object.isArray and Object.isElement (returns true if the object is a DOM node of type 1). [Tobie Langel] * Add Object.toHTML (uses the object's toHTML method if present or else passes the object to String.interpret). [Tobie Langel] * Make Element#setStyle accept a string argument of CSS rules. Deprecate uncamelized style property names when setting styles using an object (for performance reasons). Closes #9059. [Tobie Langel] Examples: $('id').setStyle('font-size: 12px; float: left; opacity: 0.5'); $('id').setStyle({fontSize: '12px', cssFloat: 'left', opacity: 0.5}); !! BACKWARDS COMPATIBILITY CHANGE !! If you have code that looks like this: $('id').setStyle({'font-size': '12px'}); You need to replace it with either of the following: $('id').setStyle({fontSize: '12px'}); $('id').setStyle('font-size: 12px;'); * Add Element#identify, which returns the element's ID if it exists, or sets and returns a unique, auto-generated ID (of the form "anonymous_element_" + auto-incremented digit) otherwise. Use this when you need to ensure an element has an ID. Closes #9012. [Jeff Watkins, sam, Tobie Langel] * Make Element#readAttribute work for cloned elements in IE. Closes #8481. [chem, Tobie Langel] * Template enhancements. Closes #8166. [Christophe Porteneuve] - Added String#interpolate as a shortcut for new Template(...).evaluate(...). - If you pass String#interpolate or Template#evaluate an object with a toTemplateReplacements() method, the return value of that method will be used as the replacement object. - You can now substitute properties of template replacement values in template strings, using dot or bracket notation (or both). Example: "#{name.last}, #{name.first[0]}. (#{location})".interpolate({ name: { first: "Christophe", last: "Porteneuve" }, location: "Paris" }) // "Porteneuve, C. (Paris)" * Extended grep semantics. The first argument to Enumerable#grep is now a "filter" (an object with a match() method) so you can now e.g. filter an array of DOM nodes by CSS selector. RegExp#match is now an alias to RegExp#test, so grep can still be used to filter an array of strings with a regular expression. Closes #7596. [Christophe Porteneuve, sam] * Make String#scan explicitly return a string. This prevents possible issues with methods expecting input data that is typeof == 'string'. Closes #6350. [AndrewRev, Tobie Langel] * Add Array#intersect for set intersection. Returns a new array containing all items common to the array and the argument, with duplicates removed (clone of the Ruby & method). [Thomas Fuchs] Example: [1,1,3,5].intersect([1,2,3]) -> [1,3] * Rename Element#getElementsBySelector to Element#select and add alias for Element#getElementsBySelector. [Thomas Fuchs] * Add Element#adjacent as a shortcut to selecting all adjacent nodes (and their children) that match a CSS selector. [Thomas Fuchs] * Enhance the Enumerable and Array APIs to more closely match those of JavaScript 1.6 as implemented in Firefox 1.5. Closes #6650, #8409. [Mislav Marohnić, Sylvain Zimmer] - Add Array#lastIndexOf, and change Array#indexOf not to overwrite the native method. - Make Enumerable use Array.prototype.forEach instead of _each when possible (slight speed increase). - Add "filter", "entries", "every", and "some" Array aliases. - All Enumerable methods now have an additional parameter, "context", which, if present, specifies the object to which the iterators' "this" is bound. - Function#bind and #curry now return the receiving function if the binding object is undefined. * Temporary workaround for Prototype.BrowserFeatures.SpecificElementExtensions incorrectly evaluating to true on iPhone. (needs further investigation) [sam] * The action for Form#request defaults to the current URL if the "action" attribute is empty. (This is what most of the major browsers do.) Fixes #8483. [Tomas, Mislav Marohnić] * In form serialization, change the way submit buttons are handled. Previously all submit buttons were serialized; now Prototype serializes only the first one. Change Form#serialize and Form.serializeElements to accept a params hash. With the "hash: false" option, a serialized string is returned instead of the hash data object. With the "submit: 'foo'" option, only the submit button with the name "foo" is serialized. References #5031. [Mislav Marohnić] Examples: $('form').serialize({ submit: 'delete' }) $('form').serialize({ hash: false }) //-> equivalent to $('form').serialize() * Form#findFirstElement respects HTML tabindexes. Closes #7595. [Christophe Porteneuve] * Added Form.Element#setValue method for setting values on various form controls. Checkboxes and radio buttons respond to a boolean and multiple select boxes expect an array of values. Closes #5902. [Jonathan Viney, Mislav Marohnić] Examples: $('text_input').setValue('hello world!') $('remember_me').setValue(true) $('attend_classes').setValue(['cheese rolling', 'evil chemistry']) * Make document.getElementsByClassName match a subset of the WHATWG Web Applications 1.0 specification which was adopted in Firefox 3 (http://www.whatwg.org/specs/web-apps/current-work/#getelementsbyclassname). It now supports multiple class names given as a whitespace-separated list in a string. Array argument is not supported. The method will only return the nodes that match all the class names. In browsers that implement the method natively it will not be overwritten. Closes #8401. [Mislav Marohnić] Example: document.getElementsByClassName('foo bar') * Fix a Safari rendering issue when floating elements could temporarily disappear when opacity was set to 1. Closes #7063. References #3044, #3813, #6706. [Thomas Fuchs, davidjrice] * Prevent a crash in Safari when calling String#evalJSON(true) on very large strings. Add String#isJSON. Closes #7834. [Tobie Langel] * Prevent a crash in Safari 1.3 on String#stripScripts and String#extractScripts. Closes #8332. [grant, Tobie Langel] * Allow JSON data to contain line breaks. Closes #8271. [pijyster, Tobie Langel] * Add Hash.prototype.index which returns the first found property that has a specific value. Closes #8528. [Thomas Fuchs, slusarz, Mislav Marohnić] Examples: var hash = $H({a:1,b:'2'}); hash.index(1) // -> 'a' hash.index('1') // -> undefined * Ensure HTMLElement exists before creating Element.extend. [Tobie Langel] * Add Number.prototype.round/ceil/floor/abs as an aliases to the respective methods in Math. Refactor to seperate number extensions from base.js. [Thomas Fuchs] * Make Element#absolutize and Element#relativize properly use Element#getStyle. Closes #8580. [Christophe Porteneuve] * Test library fixes: make rake dist work on Windows, only teardown if a browser is supported. Closes #8463, #8498. [Mislav Marohnić, grant] * Change Element.insert syntax to allow multiple positions. [Thomas Fuchs] Examples: Element.insert('foo', {top:'bar', bottom:'baz'}); $('foo').insert({after: new Element('p').update('bar')}); Element.insert('foo', new Element('p').update('bar')); // defaults to bottom Element.insert('foo', 'bar'); // defaults to bottom * String.prototype.truncate now explicitly converts its return value into a string if no truncation takes place. This prevents possible issues with methods expecting input data that is typeof == 'string'. [Thomas Fuchs, Tobie Langel, Sam Stephenson] * Event.findElement behaves as expected when the element passed matches the given selector. Closes #8395. [Mislav Marohnić, Tobie Langel] * Element.setOpacity now calls removeAttribute on the filter style on IE if no more filters remain, which makes Cleartype work properly. Closes #8376. [alexdemi, Thomas Fuchs] * Event.findElement now uses Element#up (and as a result can take a CSS selector instead of just a tag name). [Tobie Langel] * Minor cleanup of the position methods [sam] * Fix Element#clonePosition to call viewportOffset. Closes #8372. [graemenelson, Christophe Porteneuve] * Prevent an error being thrown by $$ when #id does not exist in $$("div #id"). Closes #8325. [Tobie Langel, ecke] * Make Prototype.ScriptFragment behave when including Prototype inline. [Christophe Porteneuve] * Deprecate Position (kept for backwards compatibility). Add Element#cumulativeOffset, Element#positionedOffset, Element#absolutize, Element#relativize, Element#cumulativeScrollOffset, Element#getOffsetParent, Element#viewportOffset and Element#clonePosition. [Christophe Porteneuve] * Make Element#update and Element#insert work for SELECT tags in IE and Opera. [Tobie Langel] * Make Element#insert and Element#update better handle TABLE related elements in IE and Opera. Closes #7776, #8040, #7550, #7776, #7938. [Tobie Langel] * Make Element#readAttribute('title') work in Opera. [Tobie Langel] * Make Element#replace work with form elements in Firefox and Safari. Closes #8010, #7989. [dsl239, Tobie Langel] * Add Element#wrap which wraps the element inside a new one. Closes #5732. [P. Vande, Tobie Langel] * Make Element into a constructor: new Element(tagName, attributes). Add Element#writeAttribute which accepts a hash of attributes or a name/value pair. Closes #7476. [Mislav Marohnić, haraldmartin, Tobie Langel] * Insertion overhaul: Add Element.insert(content[, position = 'bottom']). Deprecate Insertion (kept for backwards compatibility). Make Ajax.Updater option.insertion accept both Insertion.Top or the now preferred 'top'. Closes #7907. [Tobie Langel] * Refactor Element.extend and eliminate Element.extend.cache. [sam] * Add Function#curry, Function#delay, Function#defer, and Function#wrap. Closes #8134. [Andrew Dupont, Tobie Langel, sam] *1.5.1* (May 1, 2007) * Don't duplicate the event argument in Function#bindAsEventListener. Closes #6497. [wiktor] * Fix Selector :not-clause chaining. [Andrew Dupont] *1.5.1_rc4* (April 27, 2007) * Fix $F breakage from [6598]. [sam] * Set window.$continue to an Error with a helpful message for anyone who may still be using "throw $continue". [sam] * Fix jstest.rb IE support so you don't have to close the IE window after each test (yay!). Closes #8207. [Ryan Schuft] * Fix jstest.rb Konqueror support. Closes #7140. [Christophe Porteneuve] * Fix regression in which no-argument calls to Element.addMethods() would not add the methods defined in Form.Methods and Form.Element.Methods. Closes #8206. [Tobie Langel, fwittekind] * Fix Element#readAttribute to work with the 'type' attribute in IE. Closes #8160. [Tobie Langel, Wiktor Ihárosi] *1.5.1_rc3* (April 24, 2007) * Add Element#childElements as an alias for Element#immediateDescendants. [Tobie Langel] * Optimize DOM navigation methods (Element#up, Element#down, Element#previous, Element#next) for no-argument calls. Closes #7848. [haraldmartin, sam] * Add Element#firstDescendant to retrieve the first non-text child node of an element. [sam] * Element.addMethods should add methods to Element as well as Element.Methods. Closes #7888. [Andrew Dupont] * Add support for per-request onCreate callbacks to Ajax.Request. Closes #8011. [Andrew Dupont] * Don't call evalResponse() when an Ajax response has no Content-type header. Closes #7827. [Tobie Langel] * Automatically strip security delimiter comments from JSON strings before evaling them. The default delimiter is '/*-secure- ... */' or you can specify your own with the Prototype.JSONFilter regular expression. If you wrap your JSON response bodies in this delimiter on the server side, rogue external sites can't hijack potentially sensitive data via