When doing .typeString("<i>World</i>") followed by .deleteChars("World".length), an empty <i> element remains in the DOM. Not really a problem in most cases.
But when repeating the above sequence twice or more, the element and string is not completely cleared. This is only happening when wrapping the string in a HTML tag:
I'm trying to add multiple strings, each wrapped in a HTML tag, and delete them again. I'm not sure if I'm overlooking something or if this is a bug.
This codepen illustrates the problem: https://codepen.io/snap/pen/YzbVeJL?editors=1010
Problem
When doing
.typeString("<i>World</i>")
followed by.deleteChars("World".length)
, an empty<i>
element remains in the DOM. Not really a problem in most cases.But when repeating the above sequence twice or more, the element and string is not completely cleared. This is only happening when wrapping the string in a HTML tag:
When strings are not wrapped in a HTML tag it works just fine:
Workaround
When appending a space before the opening HTML tag it seems to work fine: