| CODENOTIFIER | HelpYou are not signed inSign in |
Project: dojo
Revision: 15166
Author: peller
Date: 08 Sep 2008 00:34:31
Diff at Trac: http://trac.dojotoolkit.org/changeset/15166
Changes:Fixes #5226, regression of boolean attribute handling in _Templated. Thanks, ptwobrussell! Refs #4643
Files:| ... | ...@@ -28,9 +28,10 @@ | |
| 28 | 28 | attributeMap: {}, |
| 29 | 29 | id: "test2", |
| 30 | 30 | num: 5, |
| 31 | bool: false, | |
| 31 | 32 | text: "hello <\"' world", |
| 32 | 33 | |
| 33 | templateString: "<button><span num=\"${num}\">${text}</span></button>" | |
| 34 | templateString: "<button><span num=\"${num}\" value=\"${bool}\">${text}</span></button>" | |
| 34 | 35 | }); |
| 35 | 36 | |
| 36 | 37 | // Template that starts with special node (has to be constructed inside a <tbody>) |
| ... | ...@@ -83,14 +84,14 @@ | |
| 83 | 84 | var widget=new VariableTemplate(); |
| 84 | 85 | var wrapper=dojo.byId("variables1Wrapper"); |
| 85 | 86 | wrapper.appendChild(widget.domNode); |
| 86 | t.is('<button widgetid=\"test2\"><span num="5">hello <"\' world</span></button>', wrapper.innerHTML.toLowerCase()); | |
| 87 | t.is('<button widgetid=\"test2\"><span num="5" value="false">hello <"\' world</span></button>', wrapper.innerHTML.toLowerCase()); | |
| 87 | 88 | }, |
| 88 | 89 | |
| 89 | function variables2(t){ | |
| 90 | var widget = new VariableTemplate({id: "myid", num: -5, text: ""}); | |
| 90 | function variables2(t){ | |
| 91 | var widget = new VariableTemplate({id: "myid", num: -5, bool: true, text: ""}); | |
| 91 | 92 | var wrapper=dojo.byId("variables2Wrapper"); |
| 92 | 93 | wrapper.appendChild(widget.domNode); |
| 93 | t.is('<button widgetid=\"myid\"><span num="-5"></span></button>', wrapper.innerHTML.toLowerCase()); | |
| 94 | t.is('<button widgetid=\"myid\"><span num="-5" value="true"></span></button>', wrapper.innerHTML.toLowerCase()); | |
| 94 | 95 | }, |
| 95 | 96 | function table(t){ |
| 96 | 97 | var widget=new TableRowTemplate({text: "hello"}); |
| ... | ...@@ -43,7 +43,7 @@ | |
| 43 | 43 | return dojo.string.substitute(tmpl, this, function(value, key){ |
| 44 | 44 | if(key.charAt(0) == '!'){ value = _this[key.substr(1)]; } |
| 45 | 45 | if(typeof value == "undefined"){ throw new Error(className+" template:"+key); } // a debugging aide |
| 46 | if(!value){ return ""; } | |
| 46 | if(value == null){ return ""; } | |
| 47 | 47 | |
| 48 | 48 | // Substitution keys beginning with ! will skip the transform step, |
| 49 | 49 | // in case a user wishes to insert unescaped markup, e.g. ${!foo} |
| ... | ...@@ -84,7 +84,7 @@ | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | if(this.widgetsInTemplate){ |
| 87 | var cw = this._supportingWidgets = dojo.parser.parse(node); | |
| 87 | var cw = (this._supportingWidgets = dojo.parser.parse(node)); | |
| 88 | 88 | this._attachTemplateNodes(cw, function(n,p){ |
| 89 | 89 | return n[p]; |
| 90 | 90 | }); |