##// END OF EJS Templates
Working sandbox
Working sandbox

File last commit:

r98:12074cb11473 v1.3
r99:908c1ce6ce6d v1.3
Show More
HtmlRendition.ts
39 lines | 1.1 KiB | video/mp2t | TypeScriptLexer
/ djx / src / main / ts / tsx / HtmlRendition.ts
cin
Converted to subproject djx, removed dojo-typings
r65 import dom = require("dojo/dom-construct");
import { argumentNotEmptyString } from "@implab/core-amd/safe";
import { RenditionBase } from "./RenditionBase";
cin
refactoring, adding scope to rendering methods
r96 import { placeAt } from "./traits";
import { IScope } from "./Scope";
cin
file rename
r98 import { getItemDom } from "./render";
cin
Converted to subproject djx, removed dojo-typings
r65
export class HtmlRendition extends RenditionBase<HTMLElement> {
elementType: string;
_element: HTMLElement | undefined;
constructor(elementType: string) {
argumentNotEmptyString(elementType, "elementType");
super();
this.elementType = elementType;
}
cin
refactoring, adding scope to rendering methods
r96 _addChild(child: unknown, scope: IScope): void {
cin
Converted to subproject djx, removed dojo-typings
r65 if (!this._element)
throw new Error("The HTML element isn't created");
cin
refactoring, adding scope to rendering methods
r96 placeAt(getItemDom(child, scope), this._element);
cin
Converted to subproject djx, removed dojo-typings
r65 }
cin
refactoring, adding scope to rendering methods
r96 _create(attrs: object, children: unknown[], scope: IScope) {
cin
Converted to subproject djx, removed dojo-typings
r65 this._element = dom.create(this.elementType, attrs);
cin
refactoring, adding scope to rendering methods
r96 children.forEach(v => this._addChild(v, scope));
cin
Converted to subproject djx, removed dojo-typings
r65 }
_getDomNode() {
if (!this._element)
throw new Error("The HTML element isn't created");
return this._element;
}
}