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

Cloning StyleSheets #32

Open
justinfagnani opened this issue Aug 9, 2018 · 4 comments
Open

Cloning StyleSheets #32

justinfagnani opened this issue Aug 9, 2018 · 4 comments
Labels
enhancement New feature or request

Comments

@justinfagnani
Copy link

Once it's easier to construct (or import, see WICG/webcomponents#759), they're more likely to be passed around to disparate parts of an application, which might try to independently mutate the stylesheet (say, to implement scoping via rewriting selectors).

Making it easy to clone a StyleSheet could help in code that wants to share/reuse StyleSheets safely. Clones could possibly be cheap if they allow for copy-on-write optimizations.

@rakina
Copy link
Member

rakina commented Aug 28, 2018

If we do this, should we allow it only on constructed CSSStyleSheets, or also make it possible to CSSSStyleSheets from <style> or <link>?

@tabatkins
Copy link
Contributor

I don't see any reason to limit it to constructed-only. Seems reasonable to be able to clone any stylesheet.

@rakina
Copy link
Member

rakina commented Aug 30, 2018

Yeah, I guess it makes sense. I was not sure how many parts of the source CSSStyleSheet should be kept (will it be just like making a CSSStyleSheetInit and text out of the source CSSStyleSheet and constructing with that, or are we keeping more), but looking again it seems there's only ownerNode and parentStyleSheet left (which should both be null, probably) so everything seems fine.

@tabatkins
Copy link
Contributor

Yup, exactly.

@rakina rakina added the enhancement New feature or request label Dec 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants