Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Chris78 opened this issue Feb 2, 2023 · 0 comments
Open

Comments

@Chris78
Copy link

Chris78 commented Feb 2, 2023

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

@Chris78 Chris78 changed the title Element.replace swaps element and textNode if used inside a table Element.replace() swaps element and textNode if used inside a table Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant