remove old style tags when updating components - fixes #2220

pull/7738/head
Rich Harris 7 years ago
parent 558cefa2c7
commit 307b54386c

@ -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