From e1e034ced29b0b9bf11a49798b4fba4d3dd0164d Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 21 Apr 2006 11:41:21 +0000 Subject: Update javascript libraries, rewrote client-side validators, removed some js files, simplified javascript compression. --- framework/Web/Javascripts/prototype/array.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'framework/Web/Javascripts/prototype/array.js') diff --git a/framework/Web/Javascripts/prototype/array.js b/framework/Web/Javascripts/prototype/array.js index 51ad864b..02731141 100644 --- a/framework/Web/Javascripts/prototype/array.js +++ b/framework/Web/Javascripts/prototype/array.js @@ -12,7 +12,8 @@ var $A = Array.from = function(iterable) { Object.extend(Array.prototype, Enumerable); -//Array.prototype._reverse = Array.prototype.reverse; +if (!Array.prototype._reverse) + Array.prototype._reverse = Array.prototype.reverse; Object.extend(Array.prototype, { _each: function(iterator) { @@ -41,7 +42,7 @@ Object.extend(Array.prototype, { flatten: function() { return this.inject([], function(array, value) { - return array.concat(value.constructor == Array ? + return array.concat(value && value.constructor == Array ? value.flatten() : [value]); }); }, @@ -58,20 +59,11 @@ Object.extend(Array.prototype, { if (this[i] == object) return i; return -1; }, - -/* + reverse: function(inline) { 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(', ') + ']'; } -- cgit v1.2.3