aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers
diff options
context:
space:
mode:
authorSam Stephenson <sam@37signals.com>2005-06-27 16:05:10 +0000
committerSam Stephenson <sam@37signals.com>2005-06-27 16:05:10 +0000
commit9965993e8babc177d89a547bee92573bc0712dea (patch)
tree50df76e3d5ab22f3ab7542d72e7c35bc947908d1 /actionpack/lib/action_view/helpers
parentb8689c77a49df98802ec04ca60c9602fa092385c (diff)
downloadrails-9965993e8babc177d89a547bee92573bc0712dea.tar.gz
rails-9965993e8babc177d89a547bee92573bc0712dea.tar.bz2
rails-9965993e8babc177d89a547bee92573bc0712dea.zip
Work around existing Element and Event objects in Prototype
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1543 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r--actionpack/lib/action_view/helpers/javascripts/prototype.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/actionpack/lib/action_view/helpers/javascripts/prototype.js b/actionpack/lib/action_view/helpers/javascripts/prototype.js
index 8bf3eda1a3..775ea76804 100644
--- a/actionpack/lib/action_view/helpers/javascripts/prototype.js
+++ b/actionpack/lib/action_view/helpers/javascripts/prototype.js
@@ -25,11 +25,15 @@ var Class = {
var Abstract = new Object();
-Object.prototype.extend = function(object) {
- for (property in object) {
- this[property] = object[property];
+Object.extend = function(destination, source) {
+ for (property in source) {
+ destination[property] = source[property];
}
- return this;
+ return destination;
+}
+
+Object.prototype.extend = function() {
+ return Object.extend.apply(this, arguments);
}
Function.prototype.bind = function(object) {
@@ -294,7 +298,7 @@ if (!window.Element) {
var Element = new Object();
}
-Element.extend({
+Object.extend(Element, {
toggle: function() {
for (var i = 0; i < arguments.length; i++) {
var element = $(arguments[i]);
@@ -733,11 +737,11 @@ Form.EventObserver.prototype = (new Abstract.EventObserver()).extend({
});
-//if (!window.Event) {
+if (!window.Event) {
var Event = new Object();
-//}
+}
-Event.extend({
+Object.extend(Event, {
KEY_BACKSPACE: 8,
KEY_TAB: 9,
KEY_RETURN: 13,