guiprav / junior-ui

A data binding lib like Mithril, jQuery, and someone with a weird "dom" fetish had a very ugly threesome-born baby.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change ${expr} expressions to {{expr}}

guiprav opened this issue · comments

${expr} expressions need to be escaped when used inside template literals, e.g.:

jr.createElement(`
  <a
    jr-href="https://gnu.org/\${path}"
    jr-text-content.bind="GNU \${subject}"
  ></a>
`, {
  subject: 'Philosophy',
  path: 'philosophy/philosophy.html',
});

{{expr}} expressions avoid problems (doesn't require escaping, so there's no risk forgetting to):

jr.createElement(`
  <a
    jr-href="https://gnu.org/{{path}}"
    jr-text-content.bind="GNU {{subject}}"
  ></a>
`, {
  subject: 'Philosophy',
  path: 'philosophy/philosophy.html',
});