aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r--actionpack/lib/action_view/helpers/javascript_helper.rb6
-rw-r--r--actionpack/lib/action_view/helpers/javascripts/prototype.js31
2 files changed, 9 insertions, 28 deletions
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb
index 1d70073069..6a0117a163 100644
--- a/actionpack/lib/action_view/helpers/javascript_helper.rb
+++ b/actionpack/lib/action_view/helpers/javascript_helper.rb
@@ -153,14 +153,14 @@ module ActionView
(javascript || '').gsub(/\r\n|\n|\r/, "\\n").gsub(/["']/) { |m| "\\#{m}" }
end
- private
+ private
def options_for_ajax(options)
js_options = build_callbacks(options)
js_options['asynchronous'] = options[:type] != :synchronous
js_options['method'] = options[:method] if options[:method]
js_options['position'] = options[:position] ? "'#{options[:position].to_s}'" : "'replace'"
- js_options['effect'] = ("\'"+options[:effect].to_s+"\'") if options[:effect]
+ js_options['effect'] = ("\'" + options[:effect].to_s + "\'") if options[:effect]
if options[:form]
js_options['parameters'] = 'Form.serialize(this)'
@@ -184,7 +184,7 @@ module ActionView
CALLBACKS.inject({}) do |callbacks, callback|
if options[callback]
name = 'on' + callback.to_s.capitalize
- code = escape_javascript(options[callback])
+ code = options[callback]
callbacks[name] = "function(request){#{code}}"
end
callbacks
diff --git a/actionpack/lib/action_view/helpers/javascripts/prototype.js b/actionpack/lib/action_view/helpers/javascripts/prototype.js
index 60dbd5d419..8cddf224e2 100644
--- a/actionpack/lib/action_view/helpers/javascripts/prototype.js
+++ b/actionpack/lib/action_view/helpers/javascripts/prototype.js
@@ -97,24 +97,6 @@ function getElementsByClassName(className, element) {
return elements;
}
-// function getElementsByClassName(className, element) {
-// var children = (element || document).getElementsByTagName('*');
-// var elements = new Array();
-//
-// for (var i = 0; i < children.length; i++) {
-// var child = children[i];
-// var classNames = child.className.split(' ');
-// for (var j = 0; j < classNames.length; j++) {
-// if (classNames[j] == className) {
-// elements.push(child);
-// break;
-// }
-// }
-// }
-//
-// return elements;
-// }
-
/*--------------------------------------------------------------------------*/
Ajax = {
@@ -204,12 +186,10 @@ Ajax.Updater.prototype = (new Ajax.Base()).extend({
},
updateContent: function() {
- this.container.innerHTML = this.request.transport.responseText;
-
if (this.options.position.toLowerCase() == 'replace') {
this.container.innerHTML = this.request.transport.responseText;
} else {
- Insert[this.options.position.toLowerCase()]( this.container, this.request.transport.responseText );
+ Insert[this.options.position.toLowerCase()](this.container, this.request.transport.responseText);
}
switch(this.options.effect) {
@@ -393,10 +373,11 @@ YellowFader.prototype = {
}
}
+
/*--------------------------------------------------------------------------*/
Insert = {
- before_begin: function(dom, html) {
+ before: function(dom, html) {
dom = $(dom);
if (dom.insertAdjacentHTML) {
dom.insertAdjacentHTML('BeforeBegin', html);
@@ -408,7 +389,7 @@ Insert = {
}
},
- after_begin: function(dom, html) {
+ top: function(dom, html) {
dom = $(dom);
if (dom.insertAdjacentHTML) {
dom.insertAdjacentHTML('AfterBegin', html);
@@ -421,7 +402,7 @@ Insert = {
}
},
- before_end: function(dom, html) {
+ bottom: function(dom, html) {
dom = $(dom);
if (dom.insertAdjacentHTML) {
dom.insertAdjacentHTML('BeforeEnd', html);
@@ -434,7 +415,7 @@ Insert = {
}
},
- after_end: function(dom, html) {
+ after: function(dom, html) {
dom = $(dom);
if (dom.insertAdjacentHTML) {
dom.insertAdjacentHTML('BeforeBegin', html);