From 0fb88e99c24e5905b73feac03cdd9f31097908a1 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Fri, 22 Jan 2016 23:30:06 +0200 Subject: [PATCH] Preserve redoc element params after dispose --- lib/components/Redoc/redoc.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/components/Redoc/redoc.js b/lib/components/Redoc/redoc.js index a0ccd4d5..53e16317 100644 --- a/lib/components/Redoc/redoc.js +++ b/lib/components/Redoc/redoc.js @@ -117,6 +117,7 @@ export default class Redoc extends BaseComponent { static dispose() { let dom = new BrowserDomAdapter(); let el = dom.query('redoc'); + let elClone; let parent; let nextSibling; if (el) { @@ -124,14 +125,15 @@ export default class Redoc extends BaseComponent { nextSibling = el.nextElementSibling; } + elClone = el.cloneNode(false); + if (Redoc.appRef) { Redoc.appRef.dispose(); Redoc.appRef = null; // Redoc dispose removes host element, so need to restore it - el = dom.createElement('redoc'); - el.innerText = 'Loading...'; - parent && parent.insertBefore(el, nextSibling); + elClone.innerHTML = 'Loading...'; + parent && parent.insertBefore(elClone, nextSibling); } } }