Repair relationship between ValueWidget and Widget constructors
This commit is contained in:
parent
d008cc3f94
commit
830652d71c
|
@ -34,14 +34,17 @@ export class Widget implements EventTarget {
|
|||
constructor (arg0: ChildNode | NodeGenerator | string | HTMLTemplateElement, data?: object) {
|
||||
let nodeGenerator: NodeGenerator;
|
||||
|
||||
if (data === void 0) {
|
||||
if (typeof data === 'object') {
|
||||
nodeGenerator = templateGenerator(arg0 as (string | HTMLTemplateElement), data);
|
||||
} else {
|
||||
// `data` is either undefined or "garbage" e.g. a string given to us by
|
||||
// ValueWidget's constructor.
|
||||
|
||||
if (typeof arg0 === 'function') {
|
||||
nodeGenerator = arg0 as NodeGenerator;
|
||||
} else {
|
||||
nodeGenerator = () => [arg0 as ChildNode];
|
||||
}
|
||||
} else {
|
||||
nodeGenerator = templateGenerator(arg0 as (string | HTMLTemplateElement), data);
|
||||
}
|
||||
|
||||
this.facet = Turn.activeFacet;
|
||||
|
|
Loading…
Reference in New Issue