From f9b19dc1000a302bdcaa06fe5a18a22f16c4eac5 Mon Sep 17 00:00:00 2001 From: ekhaled Date: Mon, 8 Jan 2018 16:50:17 +0000 Subject: [PATCH] add devtools visibility as suggested in sveltejs/svelte#695 --- lib/hotify.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/hotify.js b/lib/hotify.js index bbda240..cc31f2f 100644 --- a/lib/hotify.js +++ b/lib/hotify.js @@ -94,6 +94,8 @@ function createProxy (id) { target.insertBefore(this.__insertionPoint, anchor); } + this.__insertionPoint.__component__ = this; + anchor = this.__insertionPoint.nextSibling; if (target.nodeName == '#document-fragment' && insertionPoint) { @@ -110,6 +112,8 @@ function createProxy (id) { proxyComponent.prototype.destroy = function (detach, keepInsertionPoint) { removeFromMap(this); if (!keepInsertionPoint) { + //deref for GC before removal of node + this.__insertionPoint.__component__ = null; var ip = this.__insertionPoint; ip && ip.parentNode && ip.parentNode.removeChild(ip); }