#7862 closed defect (worksforme)
_Templated.js bug: templates won't substitute value 0
Reported by: | Les | Owned by: | Adam Peller |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | Dijit | Version: | 1.2.0 |
Keywords: | templated | Cc: | |
Blocked By: | Blocking: |
Description
Please take a look at the line:
if(!value){ return ""; }
If value is 0, it won't be substituted. However, 1 (or a positive number) will substitute fine.
_stringRepl: function(tmpl){ var className = this.declaredClass, _this = this; // Cache contains a string because we need to do property replacement // do the property replacement return dojo.string.substitute(tmpl, this, function(value, key){ if(key.charAt(0) == '!'){ value = _this[key.substr(1)]; } if(typeof value == "undefined"){ throw new Error(className+" template:"+key); } // a debugging aide if(!value){ return ""; } // Substitution keys beginning with ! will skip the transform step, // in case a user wishes to insert unescaped markup, e.g. ${!foo} return key.charAt(0) == "!" ? value : // Safer substitution, see heading "Attribute values" in // http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.3.2 value.toString().replace(/"/g,"""); //TODO: add &? use encodeXML method? }, this); },
Change History (5)
comment:1 Changed 14 years ago by
Owner: | set to Adam Peller |
---|
comment:2 follow-up: 3 Changed 14 years ago by
comment:3 Changed 14 years ago by
comment:4 Changed 14 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:5 Changed 14 years ago by
Milestone: | 1.2.1 → tbd |
---|
Note: See
TracTickets for help on using
tickets.
Looks like this was fixed in [15166]. Are you sure you're looking at the 1.2.0 release?
If you can still reproduce this problem on 1.2.0 please confirm and attach a test case.