Consider the following table:
<table>
<tr>
<td>
<span id='elm'>X</span> some text
</td>
</tr>
</table>
and apply the following javascript code to it:
Element.replace('elm', '<span>Y</span>')
Expected result:
The table cell should change from X some text to Y some text
Actual result:
By replacing the span it gets swapped with the textNode "some text".
So the table cell reads: some text Y
This will not happen though, if the span 'elm' is followed by an html tag (<span>, <b> or whatever).