forked from mystiq/hydrogen-web
allow t.map render fn to not return a dom node
This commit is contained in:
parent
3f36ea04f4
commit
010b782a96
1 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue