[Laszlo-dev] when setAttribute('XXXX', v) is different from setXXX(v)

Benjamin Shine ben at laszlosystems.com
Thu Nov 1 13:31:00 PDT 2007


Lou is in the process of converting the examples from using the  
special setters (setXXX(v))
to using the standard setAttribute pattern.

He points out that in at least one case, setAttribute('XXXX', v) is  
different from setXXX(v);
notably, for the "source" attribute on LzView. "source" is a  
javascript-only attribute,
according to the lps3 reference. So, we need to fine-tune our rule,  
which currently is:

"always use setAttribute('XXX', v) instead of setXXX(v) when 'XXX' is  
an attribute."

This should become... what, exactly?

On Nov 1, 2007, at 12:58 PM, Lou Iorio wrote:

> Hi Ben,
>
> In some cases, it seems that the setXXX method has more functionality
> than setAttribute, for example view.setSource.
>
> Lou
>
> Begin forwarded message:
>
>> From: Lou Iorio <liorio at laszlosystems.com>
>> Date: November 1, 2007 12:31:30 PM GMT-04:00
>> To: Benjamin Shine <ben at laszlosystems.com>
>> Subject: Re: [JIRA] Updated: (LPP-4949) Change setXXX(foo) in  
>> examples to setAttribute("XXX", foo)
>>
>> But no change to stuff that doesn't have corresponding attributes,  
>> right?
>>
>> Like LzCursor and LzFocus
>>
>> Lou
>>
>> On Oct 30, 2007, at 10:05 PM, Benjamin Shine wrote:
>>
>>> Yep, exactly.
>>>
>>> On Oct 30, 2007, at 2:04 PM, Lou Iorio wrote:
>>>
>>>> So, for example, I would change this:
>>>>
>>>> <canvas height="125">
>>>>   <debug x="400"/>
>>>>   <simplelayout/>
>>>>   <!-- Single line text, the default -->
>>>>   <text id="t1" bgcolor="#ffcccc" resize="false">
>>>>     Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
>>>>   </text>
>>>>   <text id="t2" bgcolor="#ccffcc" resize="true">
>>>>     Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
>>>>   </text>
>>>>   <button text="setText(...)">
>>>>     <handler name="onclick">
>>>>       t1.setText('resize='+t1.resize);
>>>>       t2.setText('resize='+t2.resize);
>>>>     </handler>
>>>>   </button>
>>>> </canvas>
>>>>
>>>>
>>>> to this:
>>>> <canvas height="125">
>>>>   <debug x="400"/>
>>>>   <simplelayout/>
>>>>   <!-- Single line text, the default -->
>>>>   <text id="t1" bgcolor="#ffcccc" resize="false">
>>>>     Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
>>>>   </text>
>>>>   <text id="t2" bgcolor="#ccffcc" resize="true">
>>>>     Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
>>>>   </text>
>>>>   <button text="setAttribute('text', ...)">
>>>>     <handler name="onclick">
>>>>       t1.setAttribute('text', 'resize='+t1.resize);
>>>>       t2.setAttribute('text', 'resize='+t2.resize);
>>>>     </handler>
>>>>   </button>
>>>> </canvas>
>>>>
>>>>
>>>> Begin forwarded message:
>>>>
>>>>> From: "Amy Muntz (JIRA)" <jira at laszlosystems.com>
>>>>> Date: October 29, 2007 12:43:26 PM GMT-04:00
>>>>> To: liorio at laszlosystems.com
>>>>> Subject: [JIRA] Updated: (LPP-4949) Change setXXX(foo) in  
>>>>> examples to setAttribute("XXX", foo)
>>>>>
>>>>>      [ http://www.openlaszlo.org/jira/browse/LPP-4949?page=all ]
>>>>>
>>>>> Amy Muntz updated LPP-4949:
>>>>> ---------------------------
>>>>>
>>>>>     Assignee: Lou Iorio  (was: John Sundman)
>>>>>     Priority: P0  (was: --)
>>>>>
>>>>>> Change setXXX(foo) in examples to setAttribute("XXX", foo)
>>>>>> ----------------------------------------------------------
>>>>>>
>>>>>>                 Key: LPP-4949
>>>>>>                 URL: http://www.openlaszlo.org/jira/browse/ 
>>>>>> LPP-4949
>>>>>>             Project: OpenLaszlo
>>>>>>          Issue Type: Task
>>>>>>          Components: Documentation
>>>>>>    Affects Versions: 4.0.6/Jujube
>>>>>>            Reporter: Benjamin Shine
>>>>>>         Assigned To: Lou Iorio
>>>>>>            Priority: P0
>>>>>>             Fix For: RingDing
>>>>>>
>>>>>>
>>>>>> We are leaning towards deprecating the public-ness of the  
>>>>>> setXXX methods, in favor of just setting everything with  
>>>>>> foo.setAttribute("XXX", bar).
>>>>>> However, the examples use the special setters all over.  
>>>>>> Therefore, they should be converted to use the preferred syntax.
>>>>>
>>>>> -- 
>>>>> This message is automatically generated by JIRA.
>>>>> -
>>>>> If you think it was sent incorrectly contact one of the  
>>>>> administrators: http://www.openlaszlo.org/jira/secure/ 
>>>>> Administrators.jspa
>>>>> -
>>>>> For more information on JIRA, see: http://www.atlassian.com/ 
>>>>> software/jira
>>>>>
>>>>>
>>>>
>>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20071101/c4cdf313/attachment-0001.html


More information about the Laszlo-dev mailing list