Dispose nodes associated with a LineComponent when replacing it

This commit is contained in:
Antonio Scandurra
2017-05-09 18:30:44 +02:00
parent ca3395b1b2
commit f58fd749aa

View File

@@ -3453,12 +3453,7 @@ class LinesTileComponent {
textNodesByScreenLineId
})
this.element.insertBefore(newScreenLineComponent.element, oldScreenLineComponent.element)
// Instead of calling destroy on the component here we can simply
// remove its associated element, thus skipping the
// lineNodesByScreenLineId bookkeeping. This is possible because
// lineNodesByScreenLineId has already been updated when creating the
// new screen line component.
oldScreenLineComponent.element.remove()
oldScreenLineComponent.destroy()
this.lineComponents[lineComponentIndex] = newScreenLineComponent
oldScreenLineIndex++