-
Notifications
You must be signed in to change notification settings - Fork 25
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
Can we use CSSStyleSheets from <style>/<link> in adoptedStyleSheets? #34
Comments
Could we add an |
Yeah, I think it should work. Same reason as having no restriction on cloning - there's already nothing wrong with using the same stylesheet object in multiple .adoptedStylesheets lists, or multiple custom elements, so why would it be weird to reuse one parsed by the document? |
Yeah I guess so. Should we restrict usage to the |
Oh wait, that does bring up some interesting points - I think some parts of style resolution depend on the ownerNode (or its document), like URLs? Maybe it is better to disallow "connected" stylesheets from being reused, so they have a 1-1 correspondence with their defining elements. You can always clone it into an independent sheet and just use the clone instead. |
Adopting it shouldn't be a problem I think as long it's still in the same document tree as it will keep the same |
#35 resolves this - We shouldn't be able to use them. |
I thought about this again and I can see this might be a problem with WICG/webcomponents#468. Our behavior of allowing/disallowing non-constructed stylesheet on both Let me separate this into cases of adding non-constructed stylesheets: Adding a non-constructed stylesheet that is connected (has Adding a non-constructed stylesheet that is not connected A stylesheet that has been added to adoptedStyleSheets become disconnected A stylesheet that has been added to adoptedStyleSheets got reconnected |
Closing this for now, if someone is interested in this, I'll reopen, but for now we won't allow usage of non-constructed stylesheet in |
If so, in which
DocumentOrShadowRoot
s can it be used? This is related to #23 and #15, where we want to restrict usage to oneDocument
(and any shadow trees inside it) where theCSSStyleSheet
is created.The text was updated successfully, but these errors were encountered: