Classes, no. But you can use a published property instead of a class and reflect it. Then define the :host([someAttr]) stylings within your element.
https://www.polymer-project.org/docs/polymer/polymer.html#attrreflection On Thu, Dec 11, 2014 at 2:49 PM, Sam Carecho <digiw...@gmail.com> wrote: > Eric, > > > Just one more thing, what would be the best approach to add and remove > classes to/from the host element? > On my code, as I said before, I'm using "classList" to change the host > class. Does Polymer offers a better way of doing that? > > > Cheers, > Sam > > On Thu, Dec 11, 2014 at 8:40 PM, Sam Carecho <digiw...@gmail.com> wrote: > >> Thanks a lot :) >> >> >> I would have spent hours and hours looking for the source of the error, >> if it wasn't for your help. >> >> >> Cheers, >> Sam >> >> On Thu, Dec 11, 2014 at 8:28 PM, Eric Bidelman <ebi...@gmail.com> wrote: >> >>> Object keys with "-" need to use string notation: >>> >>> {{ {'video-hero': videoHero} | tokenList}} >>> >>> On Thu, Dec 11, 2014 at 2:21 PM, Sam Carecho <digiw...@gmail.com> wrote: >>> >>>> Thank you Eric :) >>>> >>>> >>>> But I'm still doing something wrong. >>>> Regarding the declaration of the attribute "someAttribute", I got it >>>> wrong while typing the sample code that was based on the actual app code. >>>> >>>> Sorry for taking all this time from you, but please, can you take a >>>> look on this extraction of the actual code to help me identify why the >>>> expression is not working? >>>> >>>> http://jsbin.com/lifalabuhe/1/edit?html,output >>>> >>>> >>>> Cheers, >>>> Sam >>>> >>>> On Thu, Dec 11, 2014 at 7:40 PM, Eric Bidelman <ebi...@gmail.com> >>>> wrote: >>>> >>>>> Whoops. Here it is: http://jsbin.com/qaberudasa/1/edit?html,output >>>>> >>>>> On Thu, Dec 11, 2014 at 1:38 PM, Sam Carecho <digiw...@gmail.com> >>>>> wrote: >>>>> >>>>>> Eric, >>>>>> >>>>>> Thanks for the reply :) , but the jsbin link leads to a default >>>>>> jsbin, no code there, just a HTML default template. >>>>>> >>>>>> >>>>>> Cheers, >>>>>> Sam >>>>>> >>>>>> On Thu, Dec 11, 2014 at 7:31 PM, Eric Bidelman <ebi...@gmail.com> >>>>>> wrote: >>>>>> >>>>>>> That element definition doesn't match your <my-tag >>>>>>> someAttribute></my-tag> declaration. >>>>>>> >>>>>>> You want: http://jsbin.com/?html,output >>>>>>> >>>>>>> On Thu, Dec 11, 2014 at 1:25 PM, Sam Carecho <digiw...@gmail.com> >>>>>>> wrote: >>>>>>> >>>>>>>> Eric and fellows, >>>>>>>> >>>>>>>> >>>>>>>> It's not working for me. >>>>>>>> >>>>>>>> I was using javascript's "classList" "add()" and "remove()" methods >>>>>>>> to change the classes of the elements within the shadow DOM. >>>>>>>> After reading this thread I changed my code to use Polymer >>>>>>>> Expressions, but it seems that I'm doing something wrong, >>>>>>>> >>>>>>>> Can you or someone lend a little hand? >>>>>>>> >>>>>>>> Here is my code: >>>>>>>> >>>>>>>> --> the custom element tag: >>>>>>>> >>>>>>>>> <my-tag someAttribute></my-tag> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> --> the custom element definition: >>>>>>>> >>>>>>>>> <polymer-element name="my-tag" attributes="notitle author"> >>>>>>>>> <template> >>>>>>>>> <div id="someId" class="{{ {someClass: someAttribute} | >>>>>>>>> tokenList}}"></div> >>>>>>>>> </template> >>>>>>>>> <script> >>>>>>>>> Polymer({ >>>>>>>>> author: this.author, >>>>>>>>> ready: function() { } >>>>>>>>> }); >>>>>>>>> </script> >>>>>>>>> </polymer-element> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Thanks, >>>>>>>> Sam >>>>>>>> >>>>>>>> On Thu, Dec 11, 2014 at 6:43 PM, Eric Bidelman <ebi...@gmail.com> >>>>>>>> wrote: >>>>>>>> >>>>>>>>> The syntax changed, but same general idea: >>>>>>>>> >>>>>>>>> <div class="{{ {active: user.selected, big: user.type == 'super'} >>>>>>>>> | tokenList}}"> >>>>>>>>> >>>>>>>>> >>>>>>>>> https://www.polymer-project.org/docs/polymer/expressions.html#tokenlist >>>>>>>>> >>>>>>>>> On Thu, Dec 11, 2014 at 11:12 AM, <fabr...@gmail.com> wrote: >>>>>>>>> >>>>>>>>>> Hi, >>>>>>>>>> >>>>>>>>>> Just wondering does this solution still work in Polymer version >>>>>>>>>> 0.5.1? I seem to have no luck with it.... >>>>>>>>>> >>>>>>>>>> <div class="{{ active: user.selected}}"> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> If not, could someone tell me the correct way to approach this? >>>>>>>>>> >>>>>>>>>> Thanks, Willem >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Monday, June 24, 2013 3:59:03 PM UTC+1, Eric Bidelman wrote: >>>>>>>>>>> >>>>>>>>>>> No problem. There's lot-o-good stuff in there. >>>>>>>>>>> >>>>>>>>>>> I've added >>>>>>>>>>> <https://github.com/Polymer/mdv/commit/4d4966dce26da9c7168d5d9359b05c1f18e62206> >>>>>>>>>>> a link from the main MDV docs to the Expression Syntax doc. >>>>>>>>>>> Hopefully it will be easier to find next time we publish docs. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On Mon, Jun 24, 2013 at 7:54 AM, Martijn Faassen < >>>>>>>>>>> faa...@startifact.com> wrote: >>>>>>>>>>> >>>>>>>>>>>> Hi Eric, >>>>>>>>>>>> >>>>>>>>>>>> Thanks, I should read that document carefully. That looks like >>>>>>>>>>>> a nice solution! >>>>>>>>>>>> >>>>>>>>>>>> I see it also answers a question I had about accessing an outer >>>>>>>>>>>> scope >>>>>>>>>>>> object in an inner scope. Awesome! >>>>>>>>>>>> >>>>>>>>>>>> Regards, >>>>>>>>>>>> >>>>>>>>>>>> Martijn >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Follow Polymer on Google+: >>>>>>>>>> plus.google.com/107187849809354688692 >>>>>>>>>> --- >>>>>>>>>> You received this message because you are subscribed to the >>>>>>>>>> Google Groups "Polymer" group. >>>>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>>>> send an email to polymer-dev+unsubscr...@googlegroups.com. >>>>>>>>>> To view this discussion on the web visit >>>>>>>>>> https://groups.google.com/d/msgid/polymer-dev/e0b3f7e7-2b3c-446d-bebd-e00f926b46d9%40googlegroups.com >>>>>>>>>> <https://groups.google.com/d/msgid/polymer-dev/e0b3f7e7-2b3c-446d-bebd-e00f926b46d9%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>>>>>> . >>>>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>>>> >>>>>>>>> >>>>>>>>> Follow Polymer on Google+: plus.google.com/107187849809354688692 >>>>>>>>> --- >>>>>>>>> You received this message because you are subscribed to the Google >>>>>>>>> Groups "Polymer" group. >>>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>>> send an email to polymer-dev+unsubscr...@googlegroups.com. >>>>>>>>> To view this discussion on the web visit >>>>>>>>> https://groups.google.com/d/msgid/polymer-dev/CACGqRCBSV%2Bagg3nErKYDL1%3Dhk61MCZ1OM9%2Bm3%3D9s76BLpOz%3D%3DA%40mail.gmail.com >>>>>>>>> <https://groups.google.com/d/msgid/polymer-dev/CACGqRCBSV%2Bagg3nErKYDL1%3Dhk61MCZ1OM9%2Bm3%3D9s76BLpOz%3D%3DA%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>>>>> . >>>>>>>>> >>>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> > Follow Polymer on Google+: plus.google.com/107187849809354688692 --- You received this message because you are subscribed to the Google Groups "Polymer" group. To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CACGqRCAoWONY7CS%2Bn_Kp91bOEN-cS-arFn3Xk9br1phm%2B9s%3D3A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.