[Laszlo-dev] [Laszlo-checkins] r12373 - in openlaszlo/trunk: lps/components/extensions/av test/video

P T Withington ptw at pobox.com
Mon Jan 19 10:04:33 PST 2009


FWIW:

>> +           if (attrs && attrs['type'] == null) attrs.type = 'http'
>> +           if (attrs && attrs['autoplay'] == null) attrs.autoplay  
>> = false;
>> +           if (attrs && attrs['cam'] == null) attrs.cam = null;
>> +           if (attrs && attrs['mic'] == null) attrs.mic = null;
>> +           if (attrs && attrs['width'] == null) attrs.width = 160;
>> +           if (attrs && attrs['height'] == null) attrs.height = 120;
>> +           if (attrs && attrs['playvolume'] == null)  
>> attrs.playvolume = 1.0;
>> +           if (attrs && attrs['url'] == null) attrs.url = "";
>> +           super(parent, attrs, children, instcall);
>>

I realize this is JS code, but smashing defaults into attrs is  
_highly_ discouraged because attrs only sees constant values from an  
instantiation, so this operation will clobber any constraint that may  
have been specified.

If you want default values for an attribute, define an initial value  
in the <attribute> tag, or in JS as the initial value of the `var`  
declaration.





More information about the Laszlo-dev mailing list