0 Replies Latest reply on Jun 29, 2011 12:53 PM by drkstr_1

    getting a style property as a CSSStyleDeclaration

    drkstr_1 Level 4

      Hello all,


      What is the best way to reference a style class assigned to a style property in CSS?


      For example:




          titleStyle: panelTitleStyle;





          /* foo */



      Using the above CSS I can set the styleName property on, say, a Label, by using panel.getStyle("titleStyle");


      this.labelDisplay.styleName = this.getStyle("titleStyle");


      But how can I get titleStyle as an actual CSSStyleDecleration?


      Using this.styleManager.getStyleDeclaration(this.getStyle("titleStyle")) does not yield the correct style decleration. I can pull the style decleration correctly if I set titleStyle to the string value ".panelTitleStyle", but I would like to use the same selector method as if I were to set the styleName property.


      Is there just some auto-magic that appends the "." when assigning a CSS class reference to styleName, or is there a way to get the actual CSSStyleDecleration of the referenced style class? And does the style metadata tag effect this functionality at all?



      The specific use case for this questions is pertaining to the StyleableTextField, which does not use the default styleName functionality. Rather, one must assign a CSSStyleDecleration instance to it's styleDeclaration property. I need to be able to set this property based on a dynamic style set on the host component.


      Any feedback will be greatly appriciated!


      Framework Version: 4.5.1