From bb4d189b37b196dcd8bb0b5cb551e1cd7084596f Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Thu, 18 Jan 2007 22:24:27 +0000 Subject: [PATCH] prototype: Reorganize the source tree. --- CHANGELOG | 365 ++++++++++++++ LICENSE | 16 + README | 55 +++ Rakefile | 59 +++ lib/protodoc.rb | 36 ++ src/HEADER | 7 + src/ajax.js | 313 ++++++++++++ src/array.js | 111 +++++ src/base.js | 128 +++++ src/dom.js | 678 ++++++++++++++++++++++++++ src/enumerable.js | 202 ++++++++ src/event.js | 114 +++++ src/form.js | 305 ++++++++++++ src/hash.js | 91 ++++ src/position.js | 225 +++++++++ src/prototype.js | 20 + src/range.js | 29 ++ src/selector.js | 129 +++++ src/string.js | 170 +++++++ test/browser.html | 229 +++++++++ test/console.html | 110 +++++ test/lib/jstest.rb | 227 +++++++++ test/lib/unittest.js | 497 ++++++++++++++++++++ test/test.css | 49 ++ test/unit/ajax.html | 174 +++++++ test/unit/array.html | 152 ++++++ test/unit/base.html | 133 ++++++ test/unit/dom.html | 809 ++++++++++++++++++++++++++++++++ test/unit/element_mixins.html | 65 +++ test/unit/enumerable.html | 289 ++++++++++++ test/unit/fixtures/content.html | 1 + test/unit/fixtures/hello.js | 1 + test/unit/fixtures/logo.gif | Bin 0 -> 3502 bytes test/unit/form.html | 280 +++++++++++ test/unit/hash.html | 119 +++++ test/unit/position.html | 118 +++++ test/unit/range.html | 93 ++++ test/unit/selector.html | 157 +++++++ test/unit/string.html | 337 +++++++++++++ 39 files changed, 6893 insertions(+) create mode 100644 CHANGELOG create mode 100644 LICENSE create mode 100644 README create mode 100644 Rakefile create mode 100644 lib/protodoc.rb create mode 100644 src/HEADER create mode 100644 src/ajax.js create mode 100644 src/array.js create mode 100644 src/base.js create mode 100644 src/dom.js create mode 100644 src/enumerable.js create mode 100644 src/event.js create mode 100644 src/form.js create mode 100644 src/hash.js create mode 100644 src/position.js create mode 100644 src/prototype.js create mode 100644 src/range.js create mode 100644 src/selector.js create mode 100644 src/string.js create mode 100644 test/browser.html create mode 100644 test/console.html create mode 100644 test/lib/jstest.rb create mode 100644 test/lib/unittest.js create mode 100644 test/test.css create mode 100644 test/unit/ajax.html create mode 100644 test/unit/array.html create mode 100644 test/unit/base.html create mode 100644 test/unit/dom.html create mode 100644 test/unit/element_mixins.html create mode 100644 test/unit/enumerable.html create mode 100644 test/unit/fixtures/content.html create mode 100644 test/unit/fixtures/hello.js create mode 100644 test/unit/fixtures/logo.gif create mode 100644 test/unit/form.html create mode 100644 test/unit/hash.html create mode 100644 test/unit/position.html create mode 100644 test/unit/range.html create mode 100644 test/unit/selector.html create mode 100644 test/unit/string.html diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..0b30f2e --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,365 @@ +*SVN* + +* Add test to ensure Content-type header is set for simulated verbs. [sam] + +* Fix Content-Type header for HTTP methods simulated with POST not defaulting to application/x-www-form-urlencoded. [Thomas Fuchs] + +* Simplify form serialization and add support for fields with the same name as Hash methods. Closes #6649. [Mislav Marohnić] + +* Fix attribute selectors for IE. Closes #5170. [Tobie Langel, Andrew Dupont] + +* A slew of dom.js improvements. Closes #4217, #6589, #7001. [Tobie] + - Fix Element.getDimensions() for hidden elements, make Element.getHeight() use .getDimensions() + - Add Element.getWidth() + - Make Element.replace() call .toString() on the html argument (alike .update()) + - Fix an issue with Element.get/setStyle() and Safari with 'float' + - Add a bunch of missing unit tests + +* Fix an issue with Element.setStyle({opacity:''}) setting the opacity to 0 instead of removing the set inline opacity style. [Thomas Fuchs] + +* Ensure Ajax.Request's evalResponse is called before onComplete so that onComplete can reference any elements created during the response. Closes #6727. [jonathan] + +* Ensure the WEBrick test runner sets the correct Content-Type for tests and fixtures. [sam] + +* Form.serialize once again works with non-form elements. This is a temporary change to prevent the Rails link_to_remote regression described in #6898. Prototype 1.5.1 will introduce an API for working with collections of arbitrary form elements. References #6887. Closes #6898. [sam] + +* Make selectors match forms that have an element with name="id" correctly, fixes #5759 [mislav] + +* Remove support for HTTP authorization in Ajax calls introduced with #6366. Closes #6638 [jmecham] + +* Add Enumerable.size() to count elements in an enumerable and the corresponding Array.size() method, fixes #6710 [ZenCocoon] + +* Add String.succ() method to allow for String ranges, fixes #6037 [Cory Hudson, mislav] + Examples: + 'abcd'.succ(); -> 'abce' + $R('a','d').map(function(char){ return char; }); -> ['a','b','c','d'] + +* Make Element.scrollTo() correctly consider offsets of parent DOM nodes, fixes #6625 [ohader, savetheclocktower] + +* Fix Enumerable.inGroupsOf() to correctly work with fill values that evaluate to false, fixes #6782 [hawk] + +* Remove/cleanup redundant $() calls in dom.js, fixes #6817 [Tobie] + +* Don't cache files in automatic unit tests, fixes #6218 [voidlock] + +* Add $w() to easily create arrays from strings like Ruby's %w, fixes #5682 [glazedginger, brendon.aaron] + +* Add Element.toggleClassName() to toggle CSS classes on elements, fixes #6759 [Tobie] + +* Make Form.getInputs always return an array for consistency, fixes #6475 [Justin Gehtland, savetheclocktower] + +* Make TimedObserver work correctly for SELECT MULTIPLE elements, fixes #6593 [clemos, tdd] + +* Fix Template.prototype.evaluate to correctly interpret 0 and false values, add String.interpret() for safely interpreting and converting values to strings, fixes #6675 [hawk] + +* Make Element.getStyle() work with camelCased argument, fixes #6686 [Tobie] + +* Fix a redundant check in Array.prototype.compact, fixes #4739 [wlodarcz, mislav] + +* Fix $() to correctly pass back the results of document.getElementById(), notably returning "null" on elements not found, fixes #6582 [adsmart] + +* Change/add assertNull, assertUndefined, assertNullOrUndefined and not-* variants in unittest.js, fixes #6582 [adsmart] + +* Cleanup String.prototype.camelize, fix an issue with String.prototype.underscore, fixes #4714, #6685 [Tobie, Thomas Fuchs] + +* Add String.prototype.capitalize, which returns a string with the first character in upper case, fixes #6666 [Tobie] + +* Make Element.getStyle() and Element.setStyle() handle the CSS 'opacity' property transparently in IE, fixes #6093 [brandon.aaron, Tobie] + +* Fix handling of CSS 'float' property for Element.getStyle() and Element.setStyle(), fixes #4160 [Thomas Fuchs, ericf] + +* Fix that onComplete would be called twice with synchronous Ajax requests on Safari (provides units tests for #5756) [Thomas Fuchs] + +* Fix Form.Field.activate to not select text on buttons in IE, fixes #2653 [sutch, mislav, Thomas Fuchs] + +* Fix String.unescapeHTML() on Firefox for strings that are longer than 2048 bytes, fixes #5789 [Paul Moers, Thomas Fuchs] + +* Redefine Array.prototype.concat for Opera, as the native implemenation doesn't work correctly [Thomas Fuchs] + +* Add unit tests for Function.prototype.bind() [Thomas Fuchs] + +* Add String.prototype.underscore and String.prototype.dasherize [Thomas Fuchs] + Examples: + 'Hello_World'.dasherize() -> 'Hello-World' + 'borderBottomWidth'.underscore() -> 'border_bottom_width' + 'borderBottomWidth'.underscore().dasherize() -> 'border-bottom-width' + +*1.5.0_rc2* (November 11, 2006) + +* Ensure that existing DOM properties take precedence over extended element methods in all browsers. Closes #5115. [Sean Kleinjung, sam] + +* Add Element.Methods.readAttribute as a simple wrapper around getAttribute (which isn't a "real" function and doesn't have .apply or .call in Safari and IE). Useful in conjunction with Enumerable.invoke for extracting the values of a custom attribute from a collection of elements. [sam] + Example: +
+
...
+
...
+
...
+
+ + $$('div.widget').invoke('readAttribute', 'widget_id') + // ["7", "8", "9"] + +* Add Element.Methods.immediateDescendants, like $A($(element).childNodes) but without text nodes. [sam] + +* More consistency. Closes #6573. [Bob Silva] + +* String.prototype.toQueryParams and Hash.prototype.toQueryString now properly serialize arrays as multiple values. Closes #4436. [mislav, altblue, L`OcuS] + +* Fix Form.serialize for options with empty values. Closes #5033. [tdd, Thomas Fuchs, sam] + +* Add Element.Methods.Simulated for simulating HTMLElement methods in lesser browsers. Add hasAttribute as the first simulated method. [tdd, Thomas Fuchs, sam] + +* Add a "retry with throw" button for test error messages. [sam] + +* rake test now runs test/unit/*.html by default. Additionally, you can specify individual tests to run with the TESTS environment variable, and you can restrict the tests to particular browsers using the BROWSERS environment variable. [sam] + + Examples: + % BROWSERS=safari,firefox rake test + % TESTS=dom rake test + +* Element.hasClassName now bypasses the Element.ClassNames API for performance. [sam] + +* Pick some low-hanging performance and DRYness fruit. [sam] + - Inline length property accesses in for loops + - Enumerable-ize for loops where it makes sense + - Make better use of Element.Methods and Form.Methods/Form.Element.Methods + +* A slew of Ajax improvements. Closes #6366. [mislav, sam] + + Public-facing changes include: + - HTTP method can be specified in either lowercase or uppercase, and uppercase is always used when opening the XHR connection + - Added 'encoding' option (for POST) with a default of 'UTF-8' + - Ajax.Request now recognizes all the JavaScript MIME types we're aware of + - PUT body support with the 'postBody' option + - HTTP authentication support with the 'username' and 'password' options + - Query parameters can be passed as a string or as a hash + - Fixed both String.toQueryParams and Hash.toQueryString when handling empty values + - Request headers can now be specified as a hash with the 'requestHeaders' option + +* Improve performance of the common case where $ is called with a single argument. Closes #6347. [sam, rvermillion, mislav] + +* Fix Object.inspect to correctly distinguish between null and undefined, fixes #5941 [tdd, mislav] + +* Don't serialize disabled form elements, fixes #4586 [tdd] + +* Make HTML element classes extension mechanism for Safari not throw errors on WebKit beta versions [Thomas Fuchs] + +* Add support for using Element.update() with no or a non-string parameter [Thomas Fuchs] + + Example: + $('empty_me').update() -> clears the element + $('easy_as').update(123) -> set element content to '123' + +* Add unit tests for hashes, fixes #6344 [Tobie Langel] + +* Add clone() method to arrays, fixes #6338 [Tobie Langel] + +* Backing out of [5194] (Element.clear) because of issues with IE on certain elements, #6051 + +* Add Element.clear for easily emptying out elements, fixes #6051 [brandon.aaron@gmail.com] + +* Enumerable.each now returns the enumerable to allow for method chaining, fixes #6250 [eventualbuddha] + +* Make makeClipping and undoClipping always return their element to stay chainable + +* Fix an issue with certain Element chain calls not correctly extending elements with Prototype element methods on IE [Thomas Fuchs] + +* Add Enumerable.eachSlice and Enumerable.inGroupsOf, fixes #6046 [rails@tddsworld.com, Thomas Fuchs] + + Example: + [1,2,3,4,5].inGroupsOf(3) -> [[1,2,3],[4,5,null]] + [1,2,3].inGroupsOf(4,'x') -> [[1,2,3,'x']] + +* Complete unit tests for array.js and string.js [Thomas Fuchs] + +* Performance improvements for document.getElementsByClassName, including querying with XPath in supported browsers. [Andrew Dupont] + +* Make Form.getElements() return elements in the correct order, fix broken Form.serialize return, fixes #4249, #6172 [lars@pinds.com, Thomas Fuchs, john] + +* Add various DOM unit tests, fixes #6176, #6177 [tdd] + +* Split Form.serialize into Form.serialize and Form.serializeElements. The latter can be used stand-alone to serialize an array of elements you pass in, instead of the entire form [DHH] + +* Form.Element.disable() and .enable() will now work correctly, fixes #6034 [dresselm@businesslogic.com] + +* Fix IE and Safari issues with Position.positionedOffset, add position.html unit tests, fixes #5621 [renggli@iam.unibe.ch] + +* Fix an issue with Element.undoClipping and IE [Thomas Fuchs] + +* Element.cleanWhitespace now correctly removes consecutive empty text nodes, fixes #3209 [livier.duroselle@gmail.com] + +* Element.extend now does not try to extend text nodes, fixes #4642 [siegfried.puchbauer@gmail.com] + +*1.5.0_rc1* (September 4, 2006) + +* bindAsEventListener now passes along any provided arguments after the event argument. Closes #5508. [todd.fisher@revolution.com] + +* Fix makeClipping and undoClipping with local overflow style values other than visible and hidden, fixes #3672 [Thomas Fuchs] + +* Add Element.up, Element.down, Element.previous, and Element.next for easily traversing the DOM. (Inspired by Thomas Fuchs' original implementation of Element.up: http://pastie.caboo.se/7702) [sam] + + Examples: +