BorisMoore / jsrender

A lightweight, powerful and highly extensible templating engine. In the browser or on Node.js, with or without jQuery.
http://www.jsviews.com
MIT License
2.67k stars 339 forks source link

Issue in some Javascript Compilation and checking tools with JSRender #238

Closed csharbel closed 10 years ago

csharbel commented 10 years ago

Some frameworks (like the play framework) complain when they check the script if you give reserved words as property names like "$tags.for". Cannot complain since they might be right to do so according to the old ECMA Script spec. So the best option there could be to refer them as $tags['for'] instead.

They also complain when the last property in an object definition ends with a comma like in line number 1885 { fullPath: path, paths: pathStr ? [pathStr] : [], prop: prop, };

We faced these issues in the play framework but this might also be true with jshint, but not sure.

BorisMoore commented 10 years ago

For the first issue JsHint does not complain about that. Changing to $tag["for"] adds 3 characters to minified size :). I used to write to $tag["for"] but changed to the more compact form, since it is compatible with current standards. So I think I will keep the compact form. Is that a problem for you?

For the second issue, thanks, yes I had missed that. Fixing for next update.

BorisMoore commented 10 years ago

It turns out that $tag.for is a problem for IE8 (https://github.com/BorisMoore/jsviews/issues/267) - so I will indeed also change to $tag["for"] and $tag["if"]

csharbel commented 10 years ago

Thanks :+1:

BorisMoore commented 10 years ago

@csharbel: This has been fixed in Commit 56.