diff --git a/CHANGELOG b/CHANGELOG index d4be416..72d3b8b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Make Element#absolutize and Element#relativize properly use Element#getStyle. Closes #8580. [Christophe Porteneuve] + * Add Number.prototype.round as an alias to Math.round(). [Thomas Fuchs] * Test library fixes: make rake dist work on Windows, only teardown if a browser is supported. Closes #8463, #8498. [Mislav Marohnić, grant] diff --git a/src/dom.js b/src/dom.js index e92eba6..296b515 100644 --- a/src/dom.js +++ b/src/dom.js @@ -355,7 +355,7 @@ Element.Methods = { scrollTo: function(element) { element = $(element); - var pos = Position.cumulativeOffset(element); + var pos = element.cumulativeOffset(); window.scrollTo(pos[0], pos[1]); return element; }, @@ -493,7 +493,7 @@ Element.Methods = { absolutize: function(element) { element = $(element); - if (element.style.position == 'absolute') return; + if (element.getStyle('position') == 'absolute') return; // Position.prepare(); // To be done manually by Scripty when it needs it. var offsets = element.positionedOffset(); @@ -517,7 +517,7 @@ Element.Methods = { relativize: function(element) { element = $(element); - if (element.style.position == 'relative') return; + if (element.getStyle('position') == 'relative') return; // Position.prepare(); // To be done manually by Scripty when it needs it. element.style.position = 'relative'; diff --git a/test/unit/dom.html b/test/unit/dom.html index 9009282..c242637 100644 --- a/test/unit/dom.html +++ b/test/unit/dom.html @@ -68,6 +68,8 @@ height: 10em; width: 20em; } + + #notInlineAbsoluted { position: absolute; } /* for scroll test on really big screens */ body { @@ -319,6 +321,8 @@