allow t.map render fn to not return a dom node

This commit is contained in:
Bruno Windels 2021-04-01 14:59:18 +02:00
parent 3f36ea04f4
commit 010b782a96

View file

@ -322,7 +322,11 @@ class TemplateBuilder {
map(mapFn, renderFn) { map(mapFn, renderFn) {
return this.mapView(mapFn, mappedValue => { return this.mapView(mapFn, mappedValue => {
return new TemplateView(this._value, (t, vm) => { return new TemplateView(this._value, (t, vm) => {
return renderFn(mappedValue, t, vm); const rootNode = renderFn(mappedValue, t, vm);
if (!rootNode) {
return document.createComment("map placeholder");
}
return rootNode;
}); });
}); });
} }