typeit icon indicating copy to clipboard operation
typeit copied to clipboard

DOMException Thrown on `.move()` with HTML Content

Open quadratz opened this issue 1 year ago • 0 comments

The following code works perfectly fine:

new TypeIt(el)
  .type("Hello")
  .type("wrld!")
  .move(-4)
  .type("o")
  .go()

However, when wrapping the text in HTML tags, an error is thrown:

new TypeIt(el)
  .type("<span>Hello</span>")
  .type("<span>wrld!</span>")
  .move(-4)
  .type("o")
  .go()
Uncaught (in promise) DOMException: Node.insertBefore: Child to insert before is not a child of this node
    insertIntoElement index.es.js:391
    type_fn index.es.js:939
    func index.es.js:573
    execute index.es.js:289
    fireItem index.es.js:329
    beforePaint index.es.js:238
    beforePaint index.es.js:237
    beforePaint index.es.js:236
    fireItem index.es.js:328
    cb index.es.js:485
    setTimeout handler*wait/< index.es.js:488
    wait index.es.js:483
    wait_fn index.es.js:816
    fireItem index.es.js:324
    fireItemWithContext_fn index.es.js:798
    fire_fn index.es.js:737
    go index.es.js:537
    ....

quadratz avatar Aug 06 '24 12:08 quadratz