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

[1.x] Adds support for shady-unscoped attribute to style elements. #4891

Merged
merged 4 commits into from
Oct 20, 2017

Conversation

sorvell
Copy link
Contributor

@sorvell sorvell commented Oct 19, 2017

Add support for styles with a shady-unscoped attribute
Since /deep/ has been removed from Shady DOM v0, users must share styles between elements via style modules (e.g. <style include="shared-style">).

Under ShadyDOM, these styles are scoped and duplicated between elements. If these styles are intended to replace global styling done with html /deep/ ... this is inefficient since the styles are needlessly copied to each element style.

Therefore, this adds support for a shady-unscoped attribute. If this attribute is placed on a style and native Shadow DOM is not in use, then the style is copied once to the document and are left unscoped.

Please note, css custom properties are not supported in shady-unscoped styles.

Fixes #4856

Steven Orvell added 2 commits October 18, 2017 11:58
These features have been removed from the only native implementation of Shadow DOM v0 (Chrome).
Since `/deep/` has been removed from Shady DOM v0, users must share styles between elements via style modules (e.g. `<style include="shared-style">`).

Under ShadyDOM, these styles are scoped and duplicated between elements. If these styles are intended to replace global styling done with `html /deep/ ...` this is inefficient since the styles are needlessly copied to each element style.

Therefore, this adds support for a `shady-unscoped` attribute. If this attribute is placed on a style and native Shadow DOM is not in use, then the style is copied once to the document and are left unscoped.

Please note, css custom properties are not supported in `shady-unscoped` styles.
@@ -0,0 +1,26 @@
<dom-module id="global-shared1">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license header

@@ -0,0 +1,121 @@
<!doctype html>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license header

@@ -0,0 +1,3 @@
.import {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license header

@dfreedm dfreedm merged commit f530289 into 1.x Oct 20, 2017
@dfreedm dfreedm deleted the 1.x-shady-unscoped-style branch October 20, 2017 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants