remove old style tags when updating components - fixes #2220

pull/2269/head
Rich Harris 6 years ago
parent 2fc07c6dfb
commit fce96dcd75

@ -52,18 +52,17 @@
await proxy.fetchImports($bundle.imports, $bundle.import_map);
if (token !== current_token) return;
await proxy.eval(`
const styles = document.querySelectorAll('style.svelte');
let i = styles.length;
while (i--) styles[i].parentNode.removeChild(styles[i]);
`);
await proxy.eval(`
// needed for context API tutorial
window.MAPBOX_ACCESS_TOKEN = process.env.MAPBOX_ACCESS_TOKEN;
const styles = document.querySelectorAll('style[id^=svelte-]');
${$bundle.dom.code}
let i = styles.length;
while (i--) styles[i].parentNode.removeChild(styles[i]);
if (window.component) {
try {
window.component.$destroy();

Loading…
Cancel
Save