Re: Simplifying element creation

On Mon, Nov 14, 2011 at 3:41 PM, Bjoern Hoehrmann <derhoermi@gmx.net> wrote:
>
> Maybe you are looking for templates, say something like
>
>  <template name='example' white-space='tidy'>
>  <tr>
>    <td>{0}</td>
>    <td>
>      <span class='bar' style='width: {1}%'>
>        <span class='value-container'>{2}</span>
>      </span>
>    </td>
>  </tr>
>  </template>
>  ...
>  var node = fill("example", labels[i], <some expression>, values[i]);
>
> or with named parameters (make some names up), say,
>
>  var node = fill("example", {
>    '0': labels[i],
>    '1': <some expression>,
>    '2': values[i]
>  });
>
> That would seem to suit your use case better.
>

Yeah, template element will be super useful for my use case though it
doesn't address all edge cases because I have to tweak the DOM depending on
the dataset I get.

- Ryosuke

Received on Tuesday, 15 November 2011 00:09:08 UTC