PDA

View Full Version : Possible Gecko render bug?



RoryH
07-26-2005, 02:08 AM
I have a question about a "phenomenon" which I am encountering in the Gecko engine (I'm definitely not ruling out developer stupidity yet! :) ). the site I am developing uses a healthy mix of XHTML, CSS and JavaScript used to manipulate the DOM for some DHTML effects.

Basically what the page consists of is a long peice of text with superscript numbers which you can click to display a note on the text, this note appears as a Div floated to the right of the text, so hence the text wraps around the div. However... it seems that in some cases when a particular div is hidden again by setting the display property to "none" that the adjacent text does not return to it's full width, instead it stays exactly as rendered with the showing Div and leaves whitespace (background) where the Div previously was.

I appreciate that it would be alot better for anybody willing to take a look if I post the code but at present it's a bit tricky, I may be able to do it in a few hours however.

There's probably a few things I am doing manipulating the DOM with javascript which might not be considered best practice. For example before the div is displayed it is moved using the documentElement.insertBefore method so as to have it display beside the source of the onclick event.

I did however notice one common pattern with this "bug". It seems to be that when the div I'm displaying is located near the end of the <p> element in the DOM, it tends to render below the paragraph, which is fine but it is in this case when the Div is hidden that the whitespace is left intact. It's as if the render engine ignores the effect on the other <p> element sibling of the <p> element that the Div was contained in simply because the layout of the actual element that contained the Div was not effected.

I hope I made myself clear. Any input/help would be appreciated. If this is indeed a bug I imagine I can tweak things to get it to work suitably but I would prefer to know for sure what is happening.

Thanks in advance.

Forgot to mention I checked this in Firefox 1.0.4 and Netscape 8 (using FF engine). IE seems fine it.

Twey
07-26-2005, 01:39 PM
Use
javascript:alert(document.getElementById("elementID").innerHTML);
in the address bar to see how the browser sees the HTML inside the element. Find differences between the output for IE and Firefox.