diff options
author | Sam Stephenson <sam@37signals.com> | 2005-12-13 17:51:17 +0000 |
---|---|---|
committer | Sam Stephenson <sam@37signals.com> | 2005-12-13 17:51:17 +0000 |
commit | a5a54ae9e31e16b81d9ec4b8d20f3add73bb35c0 (patch) | |
tree | 940159b3ab6b441b7a6273cd2fdc39ae2cb19dfc | |
parent | 4ac2593e4e6e7bb5abbea66fea933ee209701c78 (diff) | |
download | rails-a5a54ae9e31e16b81d9ec4b8d20f3add73bb35c0.tar.gz rails-a5a54ae9e31e16b81d9ec4b8d20f3add73bb35c0.tar.bz2 rails-a5a54ae9e31e16b81d9ec4b8d20f3add73bb35c0.zip |
Update to Prototype 1.4.0 final
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3297 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/javascripts/prototype.js | 33 | ||||
-rw-r--r-- | railties/CHANGELOG | 2 | ||||
-rw-r--r-- | railties/html/javascripts/prototype.js | 33 |
4 files changed, 54 insertions, 16 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 5e1c6f58a9..cb7967601e 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Update to Prototype 1.4.0 final [Sam Stephenson] + * Added form_remote_for (form_for meets form_remote_tag) [DHH] * Update to script.aculo.us 1.5.0_rc6 diff --git a/actionpack/lib/action_view/helpers/javascripts/prototype.js b/actionpack/lib/action_view/helpers/javascripts/prototype.js index 2cca7502f7..e9ccd3c885 100644 --- a/actionpack/lib/action_view/helpers/javascripts/prototype.js +++ b/actionpack/lib/action_view/helpers/javascripts/prototype.js @@ -1,4 +1,4 @@ -/* Prototype JavaScript framework, version 1.4.0_rc4 +/* Prototype JavaScript framework, version 1.4.0 * (c) 2005 Sam Stephenson <sam@conio.net> * * THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff @@ -11,7 +11,7 @@ /*--------------------------------------------------------------------------*/ var Prototype = { - Version: '1.4.0_rc4', + Version: '1.4.0', ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)', emptyFunction: function() {}, @@ -46,10 +46,10 @@ Object.inspect = function(object) { } } -Function.prototype.bind = function(object) { - var __method = this; +Function.prototype.bind = function() { + var __method = this, args = $A(arguments), object = args.shift(); return function() { - return __method.apply(object, arguments); + return __method.apply(object, args.concat($A(arguments))); } } @@ -393,6 +393,7 @@ Object.extend(Enumerable, { entries: Enumerable.toArray }); var $A = Array.from = function(iterable) { + if (!iterable) return []; if (iterable.toArray) { return iterable.toArray(); } else { @@ -456,6 +457,14 @@ Object.extend(Array.prototype, { return (inline !== false ? this : this.toArray())._reverse(); }, + shift: function() { + var result = this[0]; + for (var i = 0; i < this.length - 1; i++) + this[i] = this[i + 1]; + this.length--; + return result; + }, + inspect: function() { return '[' + this.map(Object.inspect).join(', ') + ']'; } @@ -1253,9 +1262,17 @@ Form.Element = { var method = element.tagName.toLowerCase(); var parameter = Form.Element.Serializers[method](element); - if (parameter) - return encodeURIComponent(parameter[0]) + '=' + - encodeURIComponent(parameter[1]); + if (parameter) { + var key = encodeURIComponent(parameter[0]); + if (key.length == 0) return; + + if (parameter[1].constructor != Array) + parameter[1] = [parameter[1]]; + + return parameter[1].map(function(value) { + return key + '=' + encodeURIComponent(value); + }).join('&'); + } }, getValue: function(element) { diff --git a/railties/CHANGELOG b/railties/CHANGELOG index d198d65502..acd4ebe0e5 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Update to Prototype 1.4.0 final [Sam Stephenson] + * Update to script.aculo.us 1.5.0_rc6 * Update instructions on how to find and install generators. #3172. [Chad Fowler] diff --git a/railties/html/javascripts/prototype.js b/railties/html/javascripts/prototype.js index 2cca7502f7..e9ccd3c885 100644 --- a/railties/html/javascripts/prototype.js +++ b/railties/html/javascripts/prototype.js @@ -1,4 +1,4 @@ -/* Prototype JavaScript framework, version 1.4.0_rc4 +/* Prototype JavaScript framework, version 1.4.0 * (c) 2005 Sam Stephenson <sam@conio.net> * * THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff @@ -11,7 +11,7 @@ /*--------------------------------------------------------------------------*/ var Prototype = { - Version: '1.4.0_rc4', + Version: '1.4.0', ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)', emptyFunction: function() {}, @@ -46,10 +46,10 @@ Object.inspect = function(object) { } } -Function.prototype.bind = function(object) { - var __method = this; +Function.prototype.bind = function() { + var __method = this, args = $A(arguments), object = args.shift(); return function() { - return __method.apply(object, arguments); + return __method.apply(object, args.concat($A(arguments))); } } @@ -393,6 +393,7 @@ Object.extend(Enumerable, { entries: Enumerable.toArray }); var $A = Array.from = function(iterable) { + if (!iterable) return []; if (iterable.toArray) { return iterable.toArray(); } else { @@ -456,6 +457,14 @@ Object.extend(Array.prototype, { return (inline !== false ? this : this.toArray())._reverse(); }, + shift: function() { + var result = this[0]; + for (var i = 0; i < this.length - 1; i++) + this[i] = this[i + 1]; + this.length--; + return result; + }, + inspect: function() { return '[' + this.map(Object.inspect).join(', ') + ']'; } @@ -1253,9 +1262,17 @@ Form.Element = { var method = element.tagName.toLowerCase(); var parameter = Form.Element.Serializers[method](element); - if (parameter) - return encodeURIComponent(parameter[0]) + '=' + - encodeURIComponent(parameter[1]); + if (parameter) { + var key = encodeURIComponent(parameter[0]); + if (key.length == 0) return; + + if (parameter[1].constructor != Array) + parameter[1] = [parameter[1]]; + + return parameter[1].map(function(value) { + return key + '=' + encodeURIComponent(value); + }).join('&'); + } }, getValue: function(element) { |