Skip to content

"news" in for-loop variable name gives TypeError #42

@johannesmik

Description

@johannesmik

Following situation:

test.tpl

{% for i in news %}
{{ i.title }}
{% endfor %}

test.js

require("jinjs").registerExtension(".tpl");
var main_template = require("./test");
var context = { news : [{title: "test one"}, {title: "test two"}]};
console.log(main_template.render(context));

Then, node test.js gives me the following error:

var _fref = new $$.s || [], _prev_loop = $$.loop, _prev_key = $$['i'], _prev_value = null, k = null, v = null, i = 0, l = 0, x = null, last_v = null, last_k = null;
            ^

TypeError: $$.s is not a constructor

Changing to foo and the error goes away

If I replace news with foo or bnews, then the error doesn't occur anymore.

However, the error still occurs for words like newsarticles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions