[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with svg.js #6

Open
rossburton opened this issue Jan 18, 2021 · 1 comment
Open

Doesn't work with svg.js #6

rossburton opened this issue Jan 18, 2021 · 1 comment

Comments

@rossburton
Copy link

I've a page that embeds a number of SVGs directly into the HTML using svg.js to create the nodes. The SVGs have <style scoped> elements and the HTML loads scoped.js in the header, but the styles don't get rewritten on creation.

Should scoped be noticing document changes after it runs? Can I force it to re-run manually?

@samthor
Copy link
Owner
samthor commented Jan 18, 2021

Hm. I'd like this to work. I have a hunch that perhaps appending a lot of code at once via .innerHTML could cause a <style scoped> tag not to be upgraded.

I can look a bit in the next couple of days. Do you have a repro case?

To force it to rerun, I'm pretty sure you set styleNode.scoped to false, wait for a microtask (e.g., await Promise.resolve(), since MutationObserver runs on that) and then set it back again. Sorry that's a bit gross.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants