Prototype: Make Element#absolutize and Element#relativize properly use Element#getStyle. Closes #8580. [Christophe Porteneuve]
This commit is contained in:
parent
225597cb35
commit
0c7bac17f0
@ -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]
|
||||
|
@ -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';
|
||||
|
@ -68,6 +68,8 @@
|
||||
height: 10em;
|
||||
width: 20em;
|
||||
}
|
||||
|
||||
#notInlineAbsoluted { position: absolute; }
|
||||
|
||||
/* for scroll test on really big screens */
|
||||
body {
|
||||
@ -319,6 +321,8 @@
|
||||
<div id="absolute_relative_undefined"> </div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="notInlineAbsoluted"></div>
|
||||
<div id="inlineAbsoluted" style="position: absolute"></div>
|
||||
|
||||
<!-- Tests follow -->
|
||||
<script type="text/javascript" language="javascript" charset="utf-8">
|
||||
@ -1305,6 +1309,14 @@
|
||||
assertEqual('body_absolute', $('absolute_relative').getOffsetParent().id);
|
||||
assertEqual('absolute_relative', $('inline').getOffsetParent().id);
|
||||
assertEqual('absolute_relative', $('absolute_relative_undefined').getOffsetParent().id);
|
||||
}},
|
||||
|
||||
testAbsolutize: function() {with(this) {
|
||||
$('notInlineAbsoluted', 'inlineAbsoluted').each(function(elt) {
|
||||
if ('_originalLeft' in elt) delete elt._originalLeft;
|
||||
elt.absolutize();
|
||||
assertUndefined(elt._originalLeft, 'absolutize() did not detect absolute positioning');
|
||||
});
|
||||
}}
|
||||
}, 'testlog');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user