Skip to content

Element.replace() swaps element and textNode if used inside a table #357

@Chris78

Description

@Chris78

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions