Closed eirikwang closed 13 years ago
Latest version from GIT has this problem as well.
Try using $data.nullNested... But if you do paths a.b.c.d the template engine will not test for undefined all the way down the chain, nor does it do a try catch. Perf would be impacted if it did...
Made a workaround, ensuring all nested objects are assigned "dummy" value if null.
Given a data structure of: { nested :{value:value}, nullNested: {value:value}
When the nullNested is null or undefined, tmpl throws exception (line 361 jQuery.tmpl.js, beta1 version)
Code to reproduce: var nullCase = jQuery.tmpl("${nested.value} ${nullNested.value}", {"nested":{"value":"value"}, "nullNested":null}); var undefinedCase = jQuery.tmpl("${nested.value} ${nullNested.value}", {"nested":{"value":"value"}});