I just fixed a few bugs in a trivial web app of mine and stumbled over some interesting lines. I do not recall why I implemented those lines the way the were. Now I changed them to "normal" syntax and all is fine. My question just out of curiosity: why did the method work at all ? I'd expect a syntax error, but that was not the case. The code did work.
This is the old method implementation:
ListFillFilter: function(list){
if (OC.Shorty.Debug) OC.Shorty.Debug.log("using 'default' method to filter filled list");
// only makes sense for default OC.Shorty list
var data=new Array();
data['sum_shortys']=$('#desktop #list-of-shortys tbody tr').length;
data['sum_clicks']=0;
$('#desktop #list-of-shortys tbody tr').each(function(){
data['sum_clicks']+=parseInt($(this).attr('data-clicks'),10);
});
OC.Shorty.WUI.Sums.fill.apply(OC.Shorty.Runtime.Context.ListOfShortys,[data]),
// filter list
OC.Shorty.WUI.List.filter.apply(this,[list,'target',list.find('thead tr#toolbar th#target #filter').val()]),
OC.Shorty.WUI.List.filter.apply(this,[list,'title', list.find('thead tr#toolbar th#title #filter').val()]),
OC.Shorty.WUI.List.filter.apply(this,[list,'status',list.find('thead tr#toolbar th#status select :selected').val()])
// sort list
$.when(
OC.Shorty.Action.Preference.get('list-sort-code')
).done(function(pref){
OC.Shorty.WUI.List.sort(list,pref['list-sort-code']);
})
}, // OC.Shorty.Runtime.Context.ListOfShortys.ListAddInsert
In the middle you see 5 lines all starting with "OC.Shorty.WUI.Sums.fill.apply". These lines are terminated with a comma (",") instead of a semicolon (";"). Why did that not show up as a syntax error ?