Closed Bug 33150 Opened 26 years ago Closed 26 years ago

replaceChild on a div doesn't refresh the div

Categories

(Core :: Layout, defect, P3)

x86
Windows 98
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: marshall, Assigned: troy)

Details

I have a DHTML program that I've been working on and I found this. If I replace the first child in a <div> with a text node then the div doesn't refresh until I resize the browser window. lev = document.getElementById("score"); lev.replaceChild(document.createTextNode("score: " + score), lev.firstChild); build 2000032210
I need a complete test case for this. Otherwise I can't be sure we're fixing the problem you describe In particular, what is the first element that is getting replaced: text, an image, ... Are you replacing the child in the onload handler or in response to an event?
The div has text in it which looks like this <div id="score">Score: 0</div> The function is called via a setTimeout('myFunction', 30); If the score needs to be changed this div's text is replaced. So, no its not updated by an event.
Can you give me a simple test case that demonstrates the problem? It sure will make it easier to reproduce and verify that it is fixed
Here is the minimal test case. The div fails to refresh when its position is set to absolute. <html> <head> <style> #test {position: absolute; top: 30px; left: 0px;} </style> <script> var counter=0; function UpdateDiv() { counter++; lev = document.getElementById("test"); lev.replaceChild(document.createTextNode("Update: " + counter), lev.firstChild); } </script> </head> <body> <a onClick="UpdateDiv();">Click here</a> <div id="test"> -1 </div> </body> </html>
Thanks
Status: NEW → ASSIGNED
I'm glad you gave me a test case, because the test case shows that the DIV is absolutely positioned. That's now what I would have done to try and reproduce the problem Does the problem only happen if the DIV is absolutely positioned?
from what I can tell. I tried it set to relative and without a style and it didn't show up. In the origional case when it happened, it was positioned absolutly as well. I'm not sure if its the only case but its the only case I have found.
Fixed. There was a problem with reflow commands being coalesced across child lists
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
http://www.iprimus.ca/~brent/tech/beam/ This is not fixed! The score in the upper left corner is still not showing up. The level does, but the score doesn't. Both use replaceChild(); 2000050308
Uh, no where in the bug report until just now does it mention http://www.iprimus.ca/~brent/tech/beam/ You supplied a minimal test case, and I fixed it so the minimal test case works.
With the May 22 build, both score and level are both appearing in the window.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.