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.68k stars 340 forks source link

Undefined in jsrender.js renderContent() line 1012 #280

Closed justinnichols closed 8 years ago

justinnichols commented 8 years ago

jsrender.js Line 1012

The following line of code is producing an undefined error after simply setting up a jsrender script block and attempting to render it:

if (tag = this.tag) {

I don't know this code well (only used it as a user), but shouldn't that if-statement be something like if (tag === this.tag) { anyway? I don't expect that will necessarily fix the undefined issue, but I would guess there shouldn't be any kind of assignment being done in an if-statement.

BorisMoore commented 8 years ago

That is a deliberate assignment. The code is equivalent to:

tag = this.tag;
if (tag) {
    ...

Can you show a complete example of what you are doing, or else create a jsfiddle that shows the issue?

Clearly all the test cases and the samples (such as http://www.jsviews.com/#samples/jsr and http://www.jsviews.com/test/index.html) are working without hitting that error, so there must be something different in what you are doing... Thanks.

justinnichols commented 8 years ago

If it's a deliberate statement, then for now I'll assume it's my issue and close this. I'll open a new one if I can recreate it effectively with an example (I'm too heavily into my task for work to try to come up with it at this time).

Thanks a bunch!

BorisMoore commented 8 years ago

Sure - let me know if there is a real bug hiding there!