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

P T Withington ptw at pobox.com
Tue Jan 20 12:51:18 PST 2009


I'm ok with this if

a) you are sure the 'bug' you hit will not affect anyone else.   
Otherwise, I'd really like to see a test case.
b) you promise that the code I quoted below will go away... :)

On 2009-01-19, at 17:55EST, Sarah Allen wrote:

> The problem is that there is some bug where the defaults declared in  
> the attributes weren't getting set; however, the file is written  
> using an interim syntax that isn't exactly supported.  This is just  
> scaffolding to get the test files working, so when we translate the  
> files into normal LZX syntax we can make sure they don't break...  
> Max didn't think it made sense to dive into trying to isolate the  
> setter bug, but rather spend the time getting the code to work with  
> more supported syntax.
>
> Sarah
>
> On Jan 19, 2009, at 10:04 AM, P T Withington wrote:
>
>> 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