Changeset 15166

Show
Ignore:
Timestamp:
09/07/08 21:34:31 (3 months ago)
Author:
peller
Message:

Fixes #5226, regression of boolean attribute handling in _Templated. Thanks, ptwobrussell! Refs #4643

Location:
dijit/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/tests/_Templated.html

    r13305 r15166  
    2929                                        id: "test2", 
    3030                                        num: 5, 
     31                                        bool: false, 
    3132                                        text: "hello <\"' world", 
    3233 
    33                                         templateString: "<button><span num=\"${num}\">${text}</span></button>" 
     34                                        templateString: "<button><span num=\"${num}\" value=\"${bool}\">${text}</span></button>" 
    3435                                }); 
    3536 
     
    8485                                                        var wrapper=dojo.byId("variables1Wrapper"); 
    8586                                                        wrapper.appendChild(widget.domNode); 
    86                                                         t.is('<button widgetid=\"test2\"><span num="5">hello &lt;"\' world</span></button>', wrapper.innerHTML.toLowerCase()); 
     87                                                        t.is('<button widgetid=\"test2\"><span num="5" value="false">hello &lt;"\' world</span></button>', wrapper.innerHTML.toLowerCase()); 
    8788                                                }, 
    8889 
    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: ""}); 
    9192                                                        var wrapper=dojo.byId("variables2Wrapper"); 
    9293                                                        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()); 
    9495                                                }, 
    9596                                                function table(t){ 
  • dijit/trunk/_Templated.js

    r14828 r15166  
    4444                                if(key.charAt(0) == '!'){ value = _this[key.substr(1)]; } 
    4545                                if(typeof value == "undefined"){ throw new Error(className+" template:"+key); } // a debugging aide 
    46                                 if(!value){ return ""; } 
     46                                if(value == null){ return ""; } 
    4747 
    4848                                // Substitution keys beginning with ! will skip the transform step, 
     
    8585 
    8686                        if(this.widgetsInTemplate){ 
    87                                 var cw = this._supportingWidgets  = dojo.parser.parse(node); 
     87                                var cw = (this._supportingWidgets = dojo.parser.parse(node)); 
    8888                                this._attachTemplateNodes(cw, function(n,p){ 
    8989                                        return n[p];