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

Don't add unnecessary placeholder stylesheets #40

Closed
bedeoverend opened this issue Mar 28, 2017 · 2 comments
Closed

Don't add unnecessary placeholder stylesheets #40

bedeoverend opened this issue Mar 28, 2017 · 2 comments
Assignees

Comments

@bedeoverend
Copy link
Contributor

The placeholder plugin adds a stylesheet with every placeholder widget. See this line. They are injected alongside the placeholder so that the styles will be applied even if the simpla-text instance is being used inside a Shadow Root.

However, this is naïve - instead there need only be 1 stylesheet per Shadow Root that any simpla-text is in. The plugin should check the view.root (which corresponds to the Shadow Root or document that the element lives in) and check if a style has already been applied e.g. via root.querySelector, or by storing it directly on the root e.g. root._placeholderStyles, or by using a WeakMap

@bedeoverend
Copy link
Contributor Author

Should be noted that the downside to this is we'd be injecting DOM content into the client's DOM - injecting into the simpla-text light DOM is also running into the client's DOM, but that's less intrusive as we manage that DOM.

@bedeoverend bedeoverend changed the title [v1] Don't adding unnecessary placeholder stylesheets [v1] Don't add unnecessary placeholder stylesheets Mar 29, 2017
@madeleineostoja madeleineostoja changed the title [v1] Don't add unnecessary placeholder stylesheets Don't add unnecessary placeholder stylesheets Apr 12, 2017
@bedeoverend
Copy link
Contributor Author

Closing this as it's now a part of simpla-richtext and will be addressed in simplajs/simpla-richtext-behavior#27

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

No branches or pull requests

1 participant