G
garthusenet
I have a fairly complicated application written in Javascript+DOM, and
I've run into an odd problem that only shows up in Safari. Basically,
after setting innerHTML of a DIV, the div ends up empty instead of with
the correct content. In fact, the children of the DIV all vanish, and
it becomes impossible to set the contents thereafter.
The much simplified scenario:
<div id='divname'>
hello
</div>
var divReference = document.getElementById('divname');
divReference.innerHTML = 'loo loo loo';
alert(divReference.innerHTML);
At this point the laert box is empty. Also, when I iterate through the
properties of the divReference, they are quite messed up. For example,
firstChild and lastChild are null. Also, some properties are
duplicated.
Has anybody run into this? Unfortunately I have been unable to
reproduce in a simple test app, it seems to only happen in my
complicated app.
Also, please don't advise me to use DOM instead of innerHTML. I know
DOM is more elegant and correct, unfortunately it would be very
complicated given the amount of content I want to be pushing around.
Thanks,
Garth
I've run into an odd problem that only shows up in Safari. Basically,
after setting innerHTML of a DIV, the div ends up empty instead of with
the correct content. In fact, the children of the DIV all vanish, and
it becomes impossible to set the contents thereafter.
The much simplified scenario:
<div id='divname'>
hello
</div>
var divReference = document.getElementById('divname');
divReference.innerHTML = 'loo loo loo';
alert(divReference.innerHTML);
At this point the laert box is empty. Also, when I iterate through the
properties of the divReference, they are quite messed up. For example,
firstChild and lastChild are null. Also, some properties are
duplicated.
Has anybody run into this? Unfortunately I have been unable to
reproduce in a simple test app, it seems to only happen in my
complicated app.
Also, please don't advise me to use DOM instead of innerHTML. I know
DOM is more elegant and correct, unfortunately it would be very
complicated given the amount of content I want to be pushing around.
Thanks,
Garth