cssable.lzx
<library>
<trait name="cssable">
<attribute name="cssPropertyMap" value="null
"/>
<attribute name="cssStyle" value="null
"/>
<handler name="onconstruct" method="_applyCSS"/>
<method name="_applyCSS">
// Look up the style
this.cssStyle = LzCSSStyle.getComputedStyle( this );
var st = this.cssStyle; // put it in a register
// Debug.write("mystyle is...", mystyle);
if (st != null) {
for (var k in this.cssPropertyMap) {
var lzxPropertyName = k
var cssPropertyName = this.cssPropertyMap[k];
// Debug.write("cssName ", cssName, ", lzxPropertyName ", lzxPropertyName);
var v = st.getPropertyValue( cssPropertyName );
// this seems to be coming back null.
if (v != null) {
// Debug.write("setting value ", v , "for property", lzxPropertyName);
this.setAttribute(lzxPropertyName, v);
}
}
}
</method>
</trait>
</library>
Cross References
Named Instances