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 constructable style sheets #31

Open
jespertheend opened this issue Jun 1, 2022 · 2 comments
Open

Doesn't work with constructable style sheets #31

jespertheend opened this issue Jun 1, 2022 · 2 comments

Comments

@jespertheend
Copy link

I'm using css import assertions which are being transpiled at build time and construct-style-sheets-polyfill takes care of adding the styles in unsupported browsers.
However, this seems to be incompatible with this polyfill.

Here's a demo:
https://css-paint-polyfill-constructable-style-sheets.glitch.me/
In Chrome and Edge this works, because both constructable style sheets and css paint are supported. In Safari this also works fine somehow. But in Firefox this doesn't seem to work. The styles load fine, except for the css paint animations.

@jespertheend
Copy link
Author

I think the problem is that in Firefox support for constructable stylesheets has been enabled as of recently. And this polyfill only looks at inline styles or imports.

@developit
Copy link
Collaborator

I believe the only way to support this would be to install a setter on HTMLElement.adoptedStyleSheets that schedules scanning + replacement on those sheets. I don't know if this can be made to work with Shadow DOM though.

Notes for me: I have to check my memory here - I thought Constructible StyleSheets showed up in document.styleSheets when adopted. If so, the issue would be finding a way to install override styles - perhaps they can be appended as rules to the owner stylesheet rather than this polyfill's overrides stylesheet.

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