What steps will reproduce the problem?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>jSmart example</title>
<script type="text/javascript" src="smart-2.9.min.js"></script>
</head>
<body>
<script id="test_tpl" type="text/x-jsmart-tmpl">
{if isset($undefinedVar)}
Variable is defined.
{else}
Variable is not defined.
{/if}
</script>
<script type="text/javascript">
function isset(val) { return (typeof val !== 'undefined'); }
var tpl = new jSmart(document.getElementById('test_tpl').innerHTML);
var res = tpl.fetch();
document.write( res );
</script>
</body>
</html>
What is the expected output? What do you see instead?
Expected: Variable is not defined.
Actual: Variable is defined.
Please provide any additional information below.
The cause is that jsmart.js converts the undefined vars into empty string at
line no. 1706 of jsmart.js (function name is getVarValue())
if (typeof val == 'undefined')
{
return ''; // should have returned val;
}
Original issue reported on code.google.com by arora.gu...@gmail.com on 12 Nov 2013 at 1:01
Original issue reported on code.google.com by
arora.gu...@gmail.comon 12 Nov 2013 at 1:01