Also see:
http://jira.openlaszlo.org/jira/browse/LPP-7358
which is the improvement to add a `styleClass` property to nodes so that you
would be able to use normal CSS class syntax to apply these, e.g.:
<stylesheet>
text.gray {
color: #666666;
}
text.red {
color: #ff0000;
}
</stylesheet>
Since you seem to have separately invented the name `styleClass`, that seems
like a logical choice!
And, if you plan to use this feature pervasively in webtop, I'd make this a
hi-prio improvement to do, so we can have the 'real' syntax we want right away.
On 2010-08-17, at 14:06, Max Carlson wrote:
> (CCing laszlo-dev)
>
> This is our stopgap solution to make CSS a bit more dynamic for the new
> components - so yes, it is intentional. Clearly the docs need updating. Can
> you file an improvement for this at http://jira.openlaszlo.org/ ?
>
> It should be fairly performant - it will reapply all styles, but it's careful
> to only call setAttribute() for values that have changed. I'm sure there's
> room for improvement, but it's working well enough for our purposes so far.
> Let us know how it works for you!
>
> Regards,
> Max Carlson
> OpenLaszlo.org
>
> On 8/17/10 11:02 AM, Danielle Wheeler wrote:
>> Hi Max,
>> I have an OpenLaszlo CSS question for you. Say I have the following:
>> <canvas>
>> <stylesheet>
>> text[styleClass="gray"] {
>> color: #666666;
>> }
>> text[styleClass="red"] {
>> color: #ff0000;
>> }
>> </stylesheet>
>>
>> <text fgcolor="$style{'color'}" text="This is styled text">
>> <attribute name="styleClass" type="string" value="gray"/>
>> </text>
>> </canvas>
>>
>> If I change the 'styleClass' attribute to 'red' at runtime, the styles
>> update accordingly. Is this intended? I would like to use this behavior for
>> Webtop, but I can't find it documented anywhere. I'm also curious how
>> performant it is, since it appears to reapply all styles in the node's
>> hierarchy, even ones it's not using.
>>
>> Thanks,
>> Danielle