Skip to content

Commit

Permalink
src/index.js: Do not null elements array
Browse files Browse the repository at this point in the history
If we set `this.elements.length = 0`; aka truncating the array
then we cannot move this TonicComponent in the DOM as that
fires disconnected followed by connected callback.

Any component that renders `this.html`${this.elements}`` cannot
be safely moved around.
  • Loading branch information
Raynos committed May 5, 2020
1 parent 0d699ea commit fcd3cee
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,6 @@ class Tonic extends window.HTMLElement {

disconnectedCallback () {
Tonic._maybePromise(this.disconnected && this.disconnected())
this.elements.length = 0
this.nodes.length = 0
delete Tonic._data[this._id]
delete Tonic._children[this._id]
}
Expand Down

0 comments on commit fcd3cee

Please sign in to comment.