aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/javascripts
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-06-26 17:23:38 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-06-26 17:23:38 +0000
commitc9f2389c010ba9364a4454b45b3cedd4dd273c38 (patch)
tree1c3c83f051dbef3f3024e2e42dc31b22bd12f23a /actionpack/lib/action_view/helpers/javascripts
parent930b59eb39e2078ae83159d72dee9389ecc04897 (diff)
downloadrails-c9f2389c010ba9364a4454b45b3cedd4dd273c38.tar.gz
rails-c9f2389c010ba9364a4454b45b3cedd4dd273c38.tar.bz2
rails-c9f2389c010ba9364a4454b45b3cedd4dd273c38.zip
Update script.aculo.us scripts to fix some bugs #1515
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1528 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers/javascripts')
-rw-r--r--actionpack/lib/action_view/helpers/javascripts/controls.js3
-rw-r--r--actionpack/lib/action_view/helpers/javascripts/effects.js2
-rw-r--r--actionpack/lib/action_view/helpers/javascripts/prototype.js46
3 files changed, 31 insertions, 20 deletions
diff --git a/actionpack/lib/action_view/helpers/javascripts/controls.js b/actionpack/lib/action_view/helpers/javascripts/controls.js
index 94d438a784..4da9b52bc7 100644
--- a/actionpack/lib/action_view/helpers/javascripts/controls.js
+++ b/actionpack/lib/action_view/helpers/javascripts/controls.js
@@ -93,6 +93,7 @@ Ajax.Autocompleter.prototype = (new Ajax.Base()).extend({
onComplete: function(request) {
if(!this.changed) {
this.update.innerHTML = request.responseText;
+ Element.cleanWhitespace(this.update.firstChild);
if(this.update.firstChild && this.update.firstChild.childNodes) {
this.entry_count =
@@ -131,10 +132,12 @@ Ajax.Autocompleter.prototype = (new Ajax.Base()).extend({
case Event.KEY_UP:
this.mark_previous();
this.render();
+ if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
return;
case Event.KEY_DOWN:
this.mark_next();
this.render();
+ if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
return;
}
else
diff --git a/actionpack/lib/action_view/helpers/javascripts/effects.js b/actionpack/lib/action_view/helpers/javascripts/effects.js
index 82f1fd53ed..794c4b81a8 100644
--- a/actionpack/lib/action_view/helpers/javascripts/effects.js
+++ b/actionpack/lib/action_view/helpers/javascripts/effects.js
@@ -554,4 +554,4 @@ Element.setContentZoom = function(element, percent) {
element.style.fontSize = sizeEm*(percent/100) + "em";
if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
-} \ No newline at end of file
+}
diff --git a/actionpack/lib/action_view/helpers/javascripts/prototype.js b/actionpack/lib/action_view/helpers/javascripts/prototype.js
index 1ebb2a46b7..9b0e02cf80 100644
--- a/actionpack/lib/action_view/helpers/javascripts/prototype.js
+++ b/actionpack/lib/action_view/helpers/javascripts/prototype.js
@@ -791,41 +791,49 @@ var Position = {
return [valueL, valueT];
},
+ cumulative_offset: function(element) {
+ var valueT = 0; var valueL = 0;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ element = element.offsetParent;
+ } while(element);
+ return [valueL, valueT];
+ },
+
// caches x/y coordinate pair to use with overlap
within: function(element, x, y) {
if(this.include_scroll_offsets)
- return within_including_scrolloffsets(element, x, y);
+ return this.within_including_scrolloffsets(element, x, y);
this.xcomp = x;
this.ycomp = y;
- var offsettop = element.offsetTop;
- var offsetleft = element.offsetLeft;
- return (y>=offsettop &&
- y<offsettop+element.offsetHeight &&
- x>=offsetleft &&
- x<offsetleft+element.offsetWidth);
+ this.offset = this.cumulative_offset(element);
+
+ return (y>=this.offset[1] &&
+ y<this.offset[1]+element.offsetHeight &&
+ x>=this.offset[0] &&
+ x<this.offset[0]+element.offsetWidth);
},
within_including_scrolloffsets: function(element, x, y) {
var offsetcache = this.real_offset(element);
- this.xcomp = x + offsetcache[0] - this.deltaX;
- this.ycomp = y + offsetcache[1] - this.deltaY;
- this.xcomp = x;
- this.ycomp = y;
- var offsettop = element.offsetTop;
- var offsetleft = element.offsetLeft;
- return (y>=offsettop &&
- y<offsettop+element.offsetHeight &&
- x>=offsetleft &&
- x<offsetleft+element.offsetWidth);
+ this.offset = this.cumulative_offset(element);
+ this.xcomp = x + offsetcache[0] - this.deltaX + this.offset[0];
+ this.ycomp = y + offsetcache[1] - this.deltaY + this.offset[1];
+
+ return (this.ycomp>=this.offset[1] &&
+ this.ycomp<this.offset[1]+element.offsetHeight &&
+ this.xcomp>=this.offset[0] &&
+ this.xcomp<this.offset[0]+element.offsetWidth);
},
// within must be called directly before
overlap: function(mode, element) {
if(!mode) return 0;
if(mode == 'vertical')
- return ((element.offsetTop+element.offsetHeight)-this.ycomp) / element.offsetHeight;
+ return ((this.offset[1]+element.offsetHeight)-this.ycomp) / element.offsetHeight;
if(mode == 'horizontal')
- return ((element.offsetLeft+element.offsetWidth)-this.xcomp) / element.offsetWidth;
+ return ((this.offset[0]+element.offsetWidth)-this.xcomp) / element.offsetWidth;
},
clone: function(source, target) {