let tmpl = html`
<table>
$for address in addresses ${
html`<tr>${"first"}</tr><tr>${"last"}</tr>`
}
</table>`;
let tmpl = addresses => html`
<table>
${addresses.forEach(address=>
html`<tr>${address.first}</tr><tr>${address.last}</tr>`
).join('\n')
}
</table>`
would be my guess? Similarly for the localization example
in the blog post: arrow functions should make it relatively
painless to make the template parameters explicit.
Of course, building HTML from nested templates is not the
same as filling a flat HTML template with user input, so I'm
not sure what the implicit encoding of template parameters
will do to this approach.
Does this make sense?
Claus
// Use
console.log(tmpl({
addresses: [
{ first: Jane, last: Bond },
{ first: Lars, last: Croft },
]
}));
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss