You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I discovered the source of constant ReferenceError being thrown in my templates: $.tmpl('{{if !user}}NOUSER{{/if}}', {}), though $.tmpl('{{if user}}USER{{/if}}', {}) works silently.
In the guts the first version compiles to ... if((typeof((!user))!=='undefined' && ((!user))!=null) && ... which of course requires user to be in the scope.
Couldn't we fix that (quite valid) case of branching, or at least put big fat warning on templates usage pattern?
TIA,
--Vladimir
The text was updated successfully, but these errors were encountered:
{{if (!isEnabled())}} will work. But {{if false==isEnabled()}} will fail!
So yes, there are indeed some issues around automatic detection of null/undefined, and type function, for expression in {{if expression}}. We will be working on improvements in this area... See also issue 35
Thanks for taking the time to submit this issue. Just wanted to let you know this plugin is no longer being actively developed or maintained by the jQuery team. See README for more info.
Hi!
I discovered the source of constant ReferenceError being thrown in my templates:
$.tmpl('{{if !user}}NOUSER{{/if}}', {})
, though$.tmpl('{{if user}}USER{{/if}}', {})
works silently.In the guts the first version compiles to
... if((typeof((!user))!=='undefined' && ((!user))!=null) && ...
which of course requires user to be in the scope.Couldn't we fix that (quite valid) case of branching, or at least put big fat warning on templates usage pattern?
TIA,
--Vladimir
The text was updated successfully, but these errors were encountered: