Merge pull request #2269 from sveltejs/gh-2220

remove old style tags when updating components
pull/2270/head
Rich Harris 7 years ago committed by GitHub
commit 28f91b5681
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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