diff options
author | Sam Stephenson <sam@37signals.com> | 2007-12-05 03:08:29 +0000 |
---|---|---|
committer | Sam Stephenson <sam@37signals.com> | 2007-12-05 03:08:29 +0000 |
commit | b6d9c17af124ff64a9a189b49260c2928ac6ec7e (patch) | |
tree | 026bd46f9c28dbff76636a996237e6a68db716df /actionpack | |
parent | 37b1d33ba3c5d26b60426411122c1507eae26659 (diff) | |
download | rails-b6d9c17af124ff64a9a189b49260c2928ac6ec7e.tar.gz rails-b6d9c17af124ff64a9a189b49260c2928ac6ec7e.tar.bz2 rails-b6d9c17af124ff64a9a189b49260c2928ac6ec7e.zip |
Update Prototype to 1.6.0.1
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8276 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/javascripts/prototype.js | 65 |
2 files changed, 47 insertions, 20 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 491d6956b5..c68bc22689 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Update Prototype to 1.6.0.1. [sam] + * Update script.aculo.us to 1.8.0.1. [madrobby] * Add 'disabled' attribute to <OPTION> separators used in time zone and country selects. Closes #10354 [hasmanyjosh] diff --git a/actionpack/lib/action_view/helpers/javascripts/prototype.js b/actionpack/lib/action_view/helpers/javascripts/prototype.js index 086ba2ea69..546f9fe449 100644 --- a/actionpack/lib/action_view/helpers/javascripts/prototype.js +++ b/actionpack/lib/action_view/helpers/javascripts/prototype.js @@ -1,4 +1,4 @@ -/* Prototype JavaScript framework, version 1.6.0 +/* Prototype JavaScript framework, version 1.6.0.1 * (c) 2005-2007 Sam Stephenson * * Prototype is freely distributable under the terms of an MIT-style license. @@ -7,7 +7,7 @@ *--------------------------------------------------------------------------*/ var Prototype = { - Version: '1.6.0', + Version: '1.6.0.1', Browser: { IE: !!(window.attachEvent && !window.opera), @@ -2194,22 +2194,46 @@ if (!document.createRange || Prototype.Browser.Opera) { } if (Prototype.Browser.Opera) { - Element.Methods._getStyle = Element.Methods.getStyle; - Element.Methods.getStyle = function(element, style) { - switch(style) { - case 'left': - case 'top': - case 'right': - case 'bottom': - if (Element._getStyle(element, 'position') == 'static') return null; - default: return Element._getStyle(element, style); + Element.Methods.getStyle = Element.Methods.getStyle.wrap( + function(proceed, element, style) { + switch (style) { + case 'left': case 'top': case 'right': case 'bottom': + if (proceed(element, 'position') === 'static') return null; + case 'height': case 'width': + // returns '0px' for hidden elements; we want it to return null + if (!Element.visible(element)) return null; + + // returns the border-box dimensions rather than the content-box + // dimensions, so we subtract padding and borders from the value + var dim = parseInt(proceed(element, style), 10); + + if (dim !== element['offset' + style.capitalize()]) + return dim + 'px'; + + var properties; + if (style === 'height') { + properties = ['border-top-width', 'padding-top', + 'padding-bottom', 'border-bottom-width']; + } + else { + properties = ['border-left-width', 'padding-left', + 'padding-right', 'border-right-width']; + } + return properties.inject(dim, function(memo, property) { + var val = proceed(element, property); + return val === null ? memo : memo - parseInt(val, 10); + }) + 'px'; + default: return proceed(element, style); + } } - }; - Element.Methods._readAttribute = Element.Methods.readAttribute; - Element.Methods.readAttribute = function(element, attribute) { - if (attribute == 'title') return element.title; - return Element._readAttribute(element, attribute); - }; + ); + + Element.Methods.readAttribute = Element.Methods.readAttribute.wrap( + function(proceed, element, attribute) { + if (attribute === 'title') return element.title; + return proceed(element, attribute); + } + ); } else if (Prototype.Browser.IE) { @@ -2380,7 +2404,7 @@ else if (Prototype.Browser.WebKit) { }; // Safari returns margins on body which is incorrect if the child is absolutely - // positioned. For performance reasons, redefine Position.cumulativeOffset for + // positioned. For performance reasons, redefine Element#cumulativeOffset for // KHTML/WebKit only. Element.Methods.cumulativeOffset = function(element) { var valueT = 0, valueL = 0; @@ -2669,10 +2693,11 @@ Element.addMethods = function(methods) { document.viewport = { getDimensions: function() { var dimensions = { }; + var B = Prototype.Browser; $w('width height').each(function(d) { var D = d.capitalize(); - dimensions[d] = self['inner' + D] || - (document.documentElement['client' + D] || document.body['client' + D]); + dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner' + D] : + (B.Opera) ? document.body['client' + D] : document.documentElement['client' + D]; }); return dimensions; }, |