After Tom reviewed the patch, I went ahead and committed the enhanced widgetsInTemplates support (which used to be called enableSubWidgets).

In my previous blog post, I introduced what the support can achieve. Here I’d like to state some limitations of this patch:

  • See the second test in the widgetsInTemplates test file: if a widget template file contains its own type of widget as a child widget (not matter directly or indirectly), it will lead to a infinite loop. It would be good to detect this, however I can not come up with a decent and fast way, so I just left it as it is.
  • This kind of syntax for widgets in template file is not supported (if this syntax is used, the widget can be rendered, but attachPoint and attachEvent won’t work):
    <dojo:button .../>
    instead, please use this syntax:
    <input dojoType="dojo:Button" .../> 
    this limitation is also due to lack of decent ways of detecting the first syntax.
Some sample of how to use this, besides the test file, includes Editor2DialogContent widget defined in Editor2.js.