@@ -1,7 +1,7 | |||
|
1 | 1 | import dom = require("dojo/dom-construct"); |
|
2 | 2 | import { argumentNotNull } from "@implab/core-amd/safe"; |
|
3 | 3 | import { RenditionBase } from "./RenditionBase"; |
|
4 | import { DojoNodePosition, isInPage, isWidget } from "./traits"; | |
|
4 | import { DojoNodePosition, isElementNode, isInPage, isWidget } from "./traits"; | |
|
5 | 5 | import registry = require("dijit/registry"); |
|
6 | 6 | import ContentPane = require("dijit/layout/ContentPane"); |
|
7 | 7 | |
@@ -41,11 +41,18 export class WidgetRendition extends Ren | |||
|
41 | 41 | } else if (isWidget(child)) { |
|
42 | 42 | instance.addChild(child); |
|
43 | 43 | } else { |
|
44 | if (!instance.containerNode) | |
|
45 | throw new Error("The widget doesn't have neither addChild nor containerNode"); | |
|
44 | const childDom = this.getItemDom(child); | |
|
45 | const w = isElementNode(childDom) ? registry.byNode(childDom) : undefined; | |
|
46 | 46 | |
|
47 | // the current widget isn't started, it's children shouldn't start too | |
|
48 | dom.place(this.getItemDom(child), instance.containerNode); | |
|
47 | if (w) { | |
|
48 | instance.addChild(w); | |
|
49 | } else { | |
|
50 | if (!instance.containerNode) | |
|
51 | throw new Error("Failed to add DOM content. The widget doesn't have a containerNode"); | |
|
52 | ||
|
53 | // the current widget isn't started, it's children shouldn't start too | |
|
54 | dom.place(this.getItemDom(child), instance.containerNode); | |
|
55 | } | |
|
49 | 56 | } |
|
50 | 57 | } else { |
|
51 | 58 | if (!instance.containerNode) |
General Comments 0
You need to be logged in to leave comments.
Login now