Absolutize/Relativize IE bug

6 views
Skip to first unread message

Diodeus

unread,
Apr 8, 2008, 3:35:25 PM4/8/08
to Ruby on Rails: Spinoffs
I was playing with Element.absolutize/relativize and found that if the
DIV you're manipulating contains an image, that image will disappear
once relativize is executed after absolutize in IE 7. In the example
below, the image will vanish, but the text behave as expected.

Can anyone verify this? Does anyone have a work-around? I'm using
Prototype 1.60.

Here's the test case:

<table border='1' width='760' height='500'>
<tr>
<td>
<div id='block'>
<img src="Sample.gif" /> # TEST #
</div>
</td>
</tr>
</table>
<script language=javascript>
function setBlock() {
$('block').absolutize()
$('block').relativize()
}
window.setTimeout("setBlock()",1000)
</script>

jdalton

unread,
Apr 8, 2008, 5:56:06 PM4/8/08
to Ruby on Rails: Spinoffs

jdalton

unread,
Apr 8, 2008, 10:04:13 PM4/8/08
to Ruby on Rails: Spinoffs

Could relate to this error with positionedOffset, viewportOffset TR/TD
inner content disappears:
http://dev.rubyonrails.org/ticket/10228

Diodeus

unread,
Apr 9, 2008, 9:18:30 AM4/9/08
to Ruby on Rails: Spinoffs
Nope, no luck on either of those. The absolutize part of it works,
it's the relativize part that makes it vanish.

Strangely enough, if I do:

$('block').absolutize()
$('block').relativize()
$('block').absolutize()

...the image reappears, but that's not what I need to do.

Diodeus

unread,
Apr 9, 2008, 10:16:03 AM4/9/08
to Ruby on Rails: Spinoffs
I did manage to make a work-around.

If you make the image a CSS background it seems to work fine. Go
figure.

jdalton

unread,
May 18, 2008, 5:52:53 PM5/18/08
to Ruby on Rails: Spinoffs

This is a bug with elements inside a TD that are position "static"
being turned into postion "relative".
This causes the image elements to disappear in IE inside the element
(even nested elements).

Since this is not related to elements that where relative or absolute
this bug isn't directly related to relativize or absolutize,
but another bug entirely.

To solve you issue after calling use:
element.relativize().setStyle('position:static');

- JDD
Reply all
Reply to author
Forward
0 new messages