From c9f2389c010ba9364a4454b45b3cedd4dd273c38 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 26 Jun 2005 17:23:38 +0000 Subject: 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 --- .../action_view/helpers/javascripts/controls.js | 3 ++ .../lib/action_view/helpers/javascripts/effects.js | 2 +- .../action_view/helpers/javascripts/prototype.js | 46 +++++++++++++--------- 3 files changed, 31 insertions(+), 20 deletions(-) (limited to 'actionpack/lib/action_view/helpers/javascripts') 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=offsetleft && - x=this.offset[1] && + y=this.offset[0] && + x=offsettop && - y=offsetleft && - x=this.offset[1] && + this.ycomp=this.offset[0] && + this.xcomp