*snip*
<mixin name="replaceable">
Overrides the createChildren where it looks for immediate children with name
replace.
From it, it retrieves path attribute and using the path replaces the child
matching the path with the children of
replace. And finally removes the replace child.
</mixin>
This feature can not be achieved with extendable/extend tags because I can not
extend some arbitrary node instance.
What do you think?
---
i had achieved something very much like this by playing with the namespace-dom
tree at construct time, adding instances to the tree beneath me. Have you
considered using that data and some relatively simple dom algorithms to
instantiate classes in your hierarchy?
example i wrote but didn't try - might be a bug in there - that shows off using
a global to control what class gets used to replace something else.
<class name="replaceable">
<attribute name="using" type="string"/>
<handler name="oninit">
//which child shall we use? a? b? another one? up to us..
//we could remove what's already there too, for instance
//but we won't. keep it simple. just:
new lz[this.using](parent.a.b, {});
</handler>
</class>
<class name="foo">
<replaceable using="${canvas.class_name_to_use_in_all_replacements}"/>
<view name="a">
<view name="b"/>
</view>
</class>