Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifier plugin names conflict with template variable names #6

Closed
umakantp opened this issue Dec 25, 2014 · 0 comments
Closed

Modifier plugin names conflict with template variable names #6

umakantp opened this issue Dec 25, 2014 · 0 comments
Assignees
Labels

Comments

@umakantp
Copy link
Owner

If there is both a modifier and a variable in a scope, the two will conflict, and the modifier won't be accessible within the data section.

Example:

jSmart.prototype.registerPlugin(
    'modifier',
    'round',
    function(num, digits)
    {
        var multiplier = Math.pow(10, digits);
        return Math.round(num * multiplier) / multiplier;
    }
);

var tpl = new jSmart('{$round} {$num|round:2}');
tpl.fetch({a: 2.1324, round: 2});

Bug was reported at https://code.google.com/p/jsmart/issues/detail?id=21

@umakantp umakantp self-assigned this Dec 25, 2014
umakantp pushed a commit that referenced this issue Dec 25, 2014
…hey conflict

To avoid conflicts do not use regular function execute which evals the code with with statement.
Create a new function which calls function by object.

Reference:
#6
https://code.google.com/p/jsmart/issues/detail?id=21
@umakantp umakantp added the bug label Dec 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant