I’ll explain the scenario to make it more clear.
I wanted to add a new CSS property (overflow) which was not included in
SimpleCSSValueImpl. I noticed that valid CSS properties were specified in
SimpleCSSValuesImpl.perInstanceStyles. I suppose I could have done
SimpleCSSValuesImpl.perInstanceStyles.overflow
= 1
when the app initializes but it seems to me like a hack. Instead I wanted to
create a new class that extends SimpleCSSValuesImpl and adds overflow to its
list of allowed properties. The problem is that
SimpleCSSValuesImpl.perInstanceStyles is static, so there’s no clean way of
changing it.
So my suggestion is to change this line:
public static var perInstanceStyles:Object = {…}
with this line
public var perInstanceStyles:Object = {}
It would still be accessible the way it’s done today, i.e.
ValuesManager.valuesImpl will still be static as it is today. Any objections?
From: Alex Harui<mailto:[email protected]>
Sent: Sunday, October 30, 2016 4:07 PM
To: [email protected]<mailto:[email protected]>
Subject: Re: [FlexJS] Extending SimpleCSSValuesImpl
On 10/30/16, 4:23 AM, "yishayw" <[email protected]> wrote:
>Is there a reason why SimpleCSSValuesImpl.perInstanceStyles is static? It
>makes extending SimpleCSSValuesImpl difficult. Since there's typically
>just
>one such instance per app is there any harm in making it a dynamic
>property.
>That will allow derived classes to simply push new values upon
>construction,
>and make adding a new style property to an app easier.
>
Not sure I understand, but you can try it and see what happens. I think I
set it up as static because that way you don't have to have a reference to
the shared instance in order to change it. But maybe it is easy enough to
use ValuesManager to get there.
-Alex