##// END OF EJS Templates
Testing nested watch, release candidate
Testing nested watch, release candidate

File last commit:

r101:bb6b1db1b430 v1.3
r101:bb6b1db1b430 v1.3
Show More
HtmlRendition.ts
51 lines | 1.5 KiB | video/mp2t | TypeScriptLexer
/ djx / src / main / ts / tsx / HtmlRendition.ts
cin
Testing nested watch, release candidate
r101 import djDom = require("dojo/dom-construct");
import djAttr = require("dojo/dom-attr");
cin
Converted to subproject djx, removed dojo-typings
r65 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
Testing nested watch, release candidate
r101 import { getItemDom, renderHook } from "./render";
cin
Converted to subproject djx, removed dojo-typings
r65
cin
Testing nested watch, release candidate
r101 export class HtmlRendition extends RenditionBase<Element> {
cin
Converted to subproject djx, removed dojo-typings
r65 elementType: string;
cin
Testing nested watch, release candidate
r101 _element: Element | undefined;
cin
Converted to subproject djx, removed dojo-typings
r65
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
Testing nested watch, release candidate
r101 placeAt(getItemDom(child), this._element);
cin
Converted to subproject djx, removed dojo-typings
r65 }
cin
Testing nested watch, release candidate
r101 _create({ xmlns, ref, ...attrs }: { xmlns?: string, ref?: JSX.Ref<Element> }, children: unknown[], scope: IScope) {
if (xmlns) {
this._element = document.createElementNS(xmlns, this.elementType);
djAttr.set(this._element, attrs);
} else {
this._element = djDom.create(this.elementType, attrs);
}
cin
Converted to subproject djx, removed dojo-typings
r65
cin
refactoring, adding scope to rendering methods
r96 children.forEach(v => this._addChild(v, scope));
cin
Testing nested watch, release candidate
r101
const element = this._element;
if (ref)
renderHook(() => ref(element));
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;
}
}