prototype: Make Element#absolutize and Element#relativize always return element. Closes #10983.
This commit is contained in:
parent
ed1469396e
commit
ea9d81eea1
|
@ -1,3 +1,5 @@
|
|||
* Make Element#absolutize and Element#relativize always return element. Closes #10983. [kangax]
|
||||
|
||||
* Add deprecation extension. [Tobie Langel]
|
||||
|
||||
*1.6.0.2* (January 25, 2008)
|
||||
|
|
|
@ -527,7 +527,7 @@ Element.Methods = {
|
|||
|
||||
absolutize: function(element) {
|
||||
element = $(element);
|
||||
if (element.getStyle('position') == 'absolute') return;
|
||||
if (element.getStyle('position') == 'absolute') return element;
|
||||
// Position.prepare(); // To be done manually by Scripty when it needs it.
|
||||
|
||||
var offsets = element.positionedOffset();
|
||||
|
@ -551,7 +551,7 @@ Element.Methods = {
|
|||
|
||||
relativize: function(element) {
|
||||
element = $(element);
|
||||
if (element.getStyle('position') == 'relative') return;
|
||||
if (element.getStyle('position') == 'relative') return element;
|
||||
// Position.prepare(); // To be done manually by Scripty when it needs it.
|
||||
|
||||
element.style.position = 'relative';
|
||||
|
|
|
@ -1644,6 +1644,15 @@
|
|||
elt.absolutize();
|
||||
assertUndefined(elt._originalLeft, 'absolutize() did not detect absolute positioning');
|
||||
});
|
||||
// invoking on "absolute" positioned element should return element
|
||||
var element = $('absolute_fixed_undefined').setStyle({position: 'absolute'});
|
||||
assertEqual(element, element.absolutize());
|
||||
}},
|
||||
|
||||
testRelativize: function() {with(this) {
|
||||
// invoking on "relative" positioned element should return element
|
||||
var element = $('absolute_fixed_undefined').setStyle({position: 'relative'});
|
||||
assertEqual(element, element.relativize());
|
||||
}},
|
||||
|
||||
testViewportDimensions: function() {with(this) {
|
||||
|
|
Loading…
Reference in New Issue