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

Polymer 1.0 and WebComponents.js #1698

Closed
nazar-pc opened this issue May 31, 2015 · 6 comments
Closed

Polymer 1.0 and WebComponents.js #1698

nazar-pc opened this issue May 31, 2015 · 6 comments

Comments

@nazar-pc
Copy link
Contributor

I've being using Polymer for almost a year now and want to migrate to 1.0, so, there are couple of questions regarding use of WebComponents.js polyfills.

Distinction of native support from WebComponents.js polyfill

While maintaining Shady DOM, do you make any distinction whether real native support is available or polyfill is used?

Polymer.dom use

If WebComponents.js polyfill is present, is it possible to ignore Light DOM/Shady DOM and interact directly. I really like to be closer to native interfaces and thus additional Polymer.dom seems a bit overkill on top of everything, even though it brings performance boost (I know some of polyfill's limitations and can deal with that)

Styling

Is it possible to use ::content .special directly instead of ugly .content-wrapper > ::content .special if polyfill is used?

@namiwang
Copy link

namiwang commented Jun 1, 2015

About the first shady-dom vs native shadow-dom problem, this is what you wanna do:

  <script src="components/webcomponentsjs/webcomponents-lite.js"></script>
  <script>
    window.Polymer = window.Polymer || {};
    window.Polymer.dom = 'shadow';
  </script>

ref: https://www.polymer-project.org/1.0/docs/devguide/settings.html

@nazar-pc
Copy link
Contributor Author

nazar-pc commented Jun 1, 2015

@NanoWang, first question was not about Shady DOM vs Shadow DOM, it was about native Shadow DOM vs Shadow DOM polyfill (WebComponents.js).
I'm curious whether Polymer with window.Polymer.dom = 'shadow'; make a distinction between native support or used polyfill.

@namiwang
Copy link

namiwang commented Jun 1, 2015

@nazar-pc
Well, things are a little complicated, let me try to make it clear.

shadow-dom polyfill is included in webcomponents, and the new version of Polymer comes with a thing called shady-dom.

So there comes the webcomponents-lite, which is webcomponents minus the shadow-dom polyfill.

In your case, I guess you should include the webcomponents-lite and set window.Polymer.dom to shadow instead of shady.

@nazar-pc
Copy link
Contributor Author

nazar-pc commented Jun 1, 2015

@NanoWang you still don't understand my question at all, read it once again. I'm not asking what is included where, it seems I know that better than you. Also I'm not asking what I should include, instead I'm asking what if I will include?

@sorvell
Copy link
Contributor

sorvell commented Jun 2, 2015

While maintaining Shady DOM, do you make any distinction whether real native support is available or polyfill is used?

I'm not sure I fully understand the question, but I think the answer may be no. When Shady DOM is in use, Shadow DOM native or polyfilled is not used. Users can opt-in to using Shadow DOM. When Shadow DOM is requested, it is used if support is detected either via the platform or the polyfill. To be clear, this means you can always use Shadow DOM if you turn it on via the link above and load the full webcomponents.js polyfill.

If WebComponents.js polyfill is present, is it possible to ignore Light DOM/Shady DOM and interact directly.

Yes, but please do so with caution. If you do not use Polymer.dom, your elements may be incompatible with elements that use Shady DOM. If you are ok with requiring use of Shadow DOM native or polyfill then this should work fine.

Is it possible to use ::content .special directly instead of ugly .content-wrapper > ::content .special if polyfill is used?

Not at this time, but we'll investigate doing so in the future. Please feel free to file a separate issue on this. Thanks.

@nazar-pc
Copy link
Contributor Author

nazar-pc commented Jun 2, 2015

Thanks, @sorvell!

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

3 participants