-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Bindings in <style> no longer work under polyfill #270
Comments
I don't expect that this ever worked under the ShadowDOM polyfill. The way On Mon, Sep 9, 2013 at 9:54 AM, Eric Bidelman notifications@github.comwrote:
|
I'm positive it did, I've been struggling to get back what I used to see until last wednesday ... |
The confusion could be because before Native ShadowDOM was used by default in Chrome but recently we made a change to the way how polymer detects native support (Polymer/platform#34) and so now ShadowDOM polyfill is used by default in Chrome. So I believe it was working on Chrome before because it was using Native ShadowDOM. |
Well, is binding inside a style element something we'll be able to polyfill going forward? Or do we have to bind to the style attribute of the element? (ick) |
Further, it appears that even adding the style attribute directly to the custom element doesn't work, whether or not the values are bound. (i.e., adding style="height:100px; width:50px;" to the element won't resize it correctly, but having those values specified in the template <style> block works correctly (but not with binding) |
Example of that: http://jsbin.com/uniDEj/2/edit On Wed, Sep 18, 2013 at 8:50 AM, gavindoughtie notifications@github.comwrote:
|
Your example does not work in Chrome or Canary. |
The jsbin example above currently does not work with the ShadowDOM polyfill because bindings in style elements are not supported there. When that binding is removed, the styling works as expected: http://jsbin.com/uniDEj/11/edit. I recommend avoiding this type of binding unless you can restrict your usage to Canary with experimental web platform features on. The example works in Canary when the It's undecided whether or not we will try to add better support for bindings in style elements. Here's some more info about this issue. First, there is a performance concern with bindings in style elements. When That said, as mentioned above, these bindings don't function when using the There's 2 changes that would need to occur to support bindings in style The CSSOM issue is the reason why the fiddle above does not work. If the On Wed, Sep 18, 2013 at 9:47 AM, gavindoughtie notifications@github.comwrote:
|
Here's an example that shows how https://gist.github.com/sorvell/6772909 By default shimmed styles are hoisted to the document. In this example, an element specifically puts a copy of the shimmed styling back into its shadowRoot so bindings can be hosted in it. The @polyfill-rule is used because shimmed styles must otherwise contain valid css, not bindings. The id is used as a way of scoping the styling per instance. |
Update, the The core-style element does support creating bindings in styles and works with the ShadowDOM polyfill. |
It actually works on Chrome 38.0.2125.104 m when written like this: |
Oh and BTW, the "for-now" way, and maybe permanent one is using core-style. It supports bindings fully. Just be aware that the docs are kinda wrong you don't just have to have pure css inside the core-style element you gotta have a "style" with css inside within the "core-style" element |
@ayhankuru I was having that problem today. The problem is the Here's a workaround without Style:
Script:
I like data binding in |
@dustindowell22 I solved this problem a few weeks ago me http://jsbin.com/mutomu/1/edit?html,output 👍 |
@tjsavage - this one appears working now for me. Can we close this? Based on @dustindowell22 's jsbin example I created a codepen to test this out. |
Thanks! yes we can close this |
Wait what? That example isn't working for me in Firefox 36.0.1... |
I didn't add shims for styling because the selectors were the issue. I'll update ASAP |
FF is a major pain. That's why i've been away from polymer for a while. I had to make a decision about my project and shift it away (for now) from polymer as the deadline got shorter and it's definitely not ready for production. Chrome is as smooth as butter yet firefox just seems like it's purposely making it harder for the web components trend. Can't know why, maybe it's about focusing on FF OS maybe it's about being a jerk and going against google (mainly chrome). |
I didn't see a lot of FF only issues in 0.5 so it appears mileage may vary. On Mon, Mar 16, 2015 at 11:27 AM caiowilson notifications@github.com
|
I am sorry, right now I don't have the time. But i'll sure do as soon as I can. |
im working w/ my codepen now. Just to reiterate so we are on the same page, FF seems good on bindings not in the CSS from what I can see. CSS works other than the obvious binding so this makes me think its either in the binding part of polymer or the shadowCSS in webcomponents.js. Looking into this now |
Verified the same behavior in IE11 as in Firefox: bindings seem to work everywhere except in <style> tags. |
We have a css rule :
and the webkit line is ignored by safari. If I hard-code the binding, then it's fine. I wonder if someone can tell me how I can get it working, if it can. |
@davidmaxwaterman I've been away from polymer but if you could provide a codepen/jsbin/whatever I'd try to help you. :) |
Sorry, it's too big. I think the snippet is pretty clear...the binding doesn't work, so it's as simple as that. I think the answer is either 'it doesn't work' in a polyfill, and/or I need to do something special about it for polyfill to work as expected. I see some of both of those in the discussion above, but I'm not sure what to try. What are the options? I'm wondering about Suggestions welcome (using 0.5.5). Thanks. |
OK, I found out how to make it work. It was more a matter of understanding how the polyfill works, and then applying generic css rules taking those into account. A combination of no-shim and working out where the targets actually were. |
According to http://stackoverflow.com/questions/18702448/mustache-expressions-not-working-anymore-in-polymer-styling, bindings in
<style>
no longer work.Try: http://jsbin.com/ODEGika/3/edit
Canary works correctly for me but Chrome 29 (polyfill) does not.
The text was updated successfully, but these errors were encountered: