##// END OF EJS Templates
* tsx/{Xxx}Context renamed to tsx/{Xxx}Rendition, for old types made...
* tsx/{Xxx}Context renamed to tsx/{Xxx}Rendition, for old types made compatibility stubs with @deprected comments * Improved handling of functional component output, added support for boolean, null, undefined and widgets. * RenditionBase: fixed startup for the DocumentFragment nodes * startupWidgets: fixed startup of the widget when passed domNode of the widget. * DjxFragment converted to the functional component

File last commit:

r63:1a0018655d1c v1.1.0 default
r63:1a0018655d1c v1.1.0 default
Show More
HtmlRendition.ts
37 lines | 984 B | video/mp2t | TypeScriptLexer
/ src / main / ts / tsx / HtmlRendition.ts
import dom = require("dojo/dom-construct");
import { argumentNotEmptyString } from "@implab/core-amd/safe";
import { RenditionBase } from "./RenditionBase";
export class HtmlRendition extends RenditionBase<HTMLElement> {
elementType: string;
_element: HTMLElement | undefined;
constructor(elementType: string) {
argumentNotEmptyString(elementType, "elementType");
super();
this.elementType = elementType;
}
_addChild(child: any): void {
if (!this._element)
throw new Error("The HTML element isn't created");
dom.place(this.getItemDom(child), this._element);
}
_create(attrs: object, children: any[]) {
this._element = dom.create(this.elementType, attrs);
if (children)
children.forEach(v => this._addChild(v));
}
_getDomNode() {
if (!this._element)
throw new Error("The HTML element isn't created");
return this._element;
}
}