BorisMoore / jsviews

Interactive data-driven views, MVVM and MVP, built on top of JsRender templates
http://www.jsviews.com/#jsviews
MIT License
855 stars 130 forks source link

Regression since pre53 ? #317

Closed Jean-Pierre closed 9 years ago

Jean-Pierre commented 9 years ago

Hi, This example works with pre53 : https://jsfiddle.net/0o8gsbjm/7/

But not with next releases, (last tested: 69) : https://jsfiddle.net/0o8gsbjm/8/ {} removed around FAILED items.

{{for example.john.doe)}}
    <p>index="{{:#getIndex()}}" / name="{{>name}}" / JSON="{{:~json(12)}}" FAILED={:#index} FAILED={:~json(#data)}</p>
{{/for}}

var data = {
    example: {
        john: {
            doe: [ {name:"A"}, {name:"B"}, {name:"C"} ] 
        }
    }
};
BorisMoore commented 9 years ago

Hi Jean-Pierre,

It looks like you have an inappropriate ) - should be {{for example.john.doe}}, not {{for example.john.doe)}}.

On removing the paren it seems to work correctly: https://jsfiddle.net/0o8gsbjm/9/

The fact that it worked in 53 was pure luck :) - because somehow the parsing didn't get thrown by the additional ). But that syntax is incorrect of course and not supported.

Jean-Pierre commented 9 years ago

Yes! syntax error would be fine :-(

Thanks! Closed

BorisMoore commented 9 years ago

OK - it was not too hard. I have added a test for balanced parens, so in the next update there will be a syntax error for your case above... :)

BorisMoore commented 8 years ago

Improved syntax error detection added in commit 70