From d777e506f27debdb5c66cc6653e2f3dc1b634d88 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Sat, 19 Nov 2005 06:59:07 +0000 Subject: Update to Prototype 1.4.0_rc4. Closes #2943 (old Array.prototype.reverse behavior can be obtained by passing false as an argument) git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3091 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/CHANGELOG | 2 ++ .../action_view/helpers/javascripts/prototype.js | 28 +++++++++++++++------- railties/CHANGELOG | 2 ++ railties/html/javascripts/prototype.js | 28 +++++++++++++++------- 4 files changed, 42 insertions(+), 18 deletions(-) diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 6bdfec8ae1..5f44322290 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Update to Prototype 1.4.0_rc4. Closes #2943 (old Array.prototype.reverse behavior can be obtained by passing false as an argument). [Sam Stephenson] + * Use Element.update('id', 'html') instead of $('id').innerHTML = 'html' in JavaScriptGenerator#replace_html so that script tags are evaluated. [Sam Stephenson] * Make rjs templates always implicitly skip out on layouts. [Marcel Molina Jr.] diff --git a/actionpack/lib/action_view/helpers/javascripts/prototype.js b/actionpack/lib/action_view/helpers/javascripts/prototype.js index 211814fdce..2cca7502f7 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_rc3 +/* Prototype JavaScript framework, version 1.4.0_rc4 * (c) 2005 Sam Stephenson * * THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff @@ -11,7 +11,7 @@ /*--------------------------------------------------------------------------*/ var Prototype = { - Version: '1.4.0_rc3', + Version: '1.4.0_rc4', ScriptFragment: '(?:)((\n|\r|.)*?)(?:<\/script>)', emptyFunction: function() {}, @@ -405,12 +405,19 @@ var $A = Array.from = function(iterable) { Object.extend(Array.prototype, Enumerable); +Array.prototype._reverse = Array.prototype.reverse; + Object.extend(Array.prototype, { _each: function(iterator) { for (var i = 0; i < this.length; i++) iterator(this[i]); }, + clear: function() { + this.length = 0; + return this; + }, + first: function() { return this[0]; }, @@ -445,11 +452,8 @@ Object.extend(Array.prototype, { return -1; }, - reverse: function() { - var result = []; - for (var i = this.length; i > 0; i--) - result.push(this[i-1]); - return result; + reverse: function(inline) { + return (inline !== false ? this : this.toArray())._reverse(); }, inspect: function() { @@ -709,7 +713,7 @@ Ajax.Request.prototype = Object.extend(new Ajax.Base(), { this.dispatchException(e); } - if (this.header('Content-type') == 'text/javascript') + if ((this.header('Content-type') || '').match(/^text\/javascript/i)) this.evalResponse(); } @@ -932,6 +936,12 @@ Object.extend(Element, { return value == 'auto' ? null : value; }, + setStyle: function(element, style) { + element = $(element); + for (name in style) + element.style[name.camelize()] = style[name]; + }, + getDimensions: function(element) { element = $(element); if (Element.getStyle(element, 'display') != 'none') @@ -1059,7 +1069,7 @@ Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), { }, insertContent: function(fragments) { - fragments.reverse().each((function(fragment) { + fragments.reverse(false).each((function(fragment) { this.element.insertBefore(fragment, this.element.firstChild); }).bind(this)); } diff --git a/railties/CHANGELOG b/railties/CHANGELOG index b15d7b3883..2db221f579 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Update to Prototype 1.4.0_rc4. Closes #2943 (old Array.prototype.reverse behavior can be obtained by passing false as an argument). [Sam Stephenson] + * script/console uses RAILS_ENV environment variable if present. #2932 [Blair Zajac * Windows: eliminate the socket option in database.yml. #2924 [Wayne Vucenic ] diff --git a/railties/html/javascripts/prototype.js b/railties/html/javascripts/prototype.js index 211814fdce..2cca7502f7 100644 --- a/railties/html/javascripts/prototype.js +++ b/railties/html/javascripts/prototype.js @@ -1,4 +1,4 @@ -/* Prototype JavaScript framework, version 1.4.0_rc3 +/* Prototype JavaScript framework, version 1.4.0_rc4 * (c) 2005 Sam Stephenson * * THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff @@ -11,7 +11,7 @@ /*--------------------------------------------------------------------------*/ var Prototype = { - Version: '1.4.0_rc3', + Version: '1.4.0_rc4', ScriptFragment: '(?:)((\n|\r|.)*?)(?:<\/script>)', emptyFunction: function() {}, @@ -405,12 +405,19 @@ var $A = Array.from = function(iterable) { Object.extend(Array.prototype, Enumerable); +Array.prototype._reverse = Array.prototype.reverse; + Object.extend(Array.prototype, { _each: function(iterator) { for (var i = 0; i < this.length; i++) iterator(this[i]); }, + clear: function() { + this.length = 0; + return this; + }, + first: function() { return this[0]; }, @@ -445,11 +452,8 @@ Object.extend(Array.prototype, { return -1; }, - reverse: function() { - var result = []; - for (var i = this.length; i > 0; i--) - result.push(this[i-1]); - return result; + reverse: function(inline) { + return (inline !== false ? this : this.toArray())._reverse(); }, inspect: function() { @@ -709,7 +713,7 @@ Ajax.Request.prototype = Object.extend(new Ajax.Base(), { this.dispatchException(e); } - if (this.header('Content-type') == 'text/javascript') + if ((this.header('Content-type') || '').match(/^text\/javascript/i)) this.evalResponse(); } @@ -932,6 +936,12 @@ Object.extend(Element, { return value == 'auto' ? null : value; }, + setStyle: function(element, style) { + element = $(element); + for (name in style) + element.style[name.camelize()] = style[name]; + }, + getDimensions: function(element) { element = $(element); if (Element.getStyle(element, 'display') != 'none') @@ -1059,7 +1069,7 @@ Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), { }, insertContent: function(fragments) { - fragments.reverse().each((function(fragment) { + fragments.reverse(false).each((function(fragment) { this.element.insertBefore(fragment, this.element.firstChild); }).bind(this)); } -- cgit v1.2.3