[Laszlo-dev] createChildren

Rami Ojares / AMG Oy rami.ojares at archon.fi
Tue Nov 24 14:01:33 PST 2009


Hi,

Current documentation has this to say about node's createChildren(carr) 
argument

"an array of children where the structure of each child [c] takes the form:
c.name = a string containing the name of the child -- usually its 
constructor
c.args = a dictionary of attributes and values to be passed to the 
constructor of that child
c.children = an array of children for the new child"

None of this seems to be true.
Instead the children seems to have the structure:
c.attrs = a dictionary of attributes and values to be passed to the 
constructor of that child
c.class = pointer to the class to be instantiated

When you further inspect the class there is one useful attribute:
tagname. That seems to have the same function as c.name in the above 
mentioned documentation.

Further it seems that in the current trunk if you instantiate a class 
with a constrained attribute like this

<view height="${foo.height}"/>

It's tagname becomes
"anonymous tagname"

Code:

<canvas debug="true">
     <view >
         <method name="createChildren" args="children"><![CDATA[
             for(var i=0; i<children.length; i++) {
                 Debug.write(children[i]['class'].tagname);
             }
         ]]></method>
         <view height="${canvas.height}"/>
         <view/>
     </view>
</canvas>

Produces the output in debug window:
anonymous view
view

Is this how it is supposed to be?
Or is this an accident caused by the instance specific mixin development?

- rami


More information about the Laszlo-dev mailing list