Changeset 10979

Show
Ignore:
Timestamp:
10/19/07 04:24:42 (9 months ago)
Author:
alex
Message:

ensure that Declarations always use a string template for construction instead of the potential node-cached variant. Fixes #4643

Location:
dijit/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/Declaration.js

    r10522 r10979  
    3636                        } 
    3737                        propList.widgetsInTemplate = true; 
     38                        propList._skipNodeCache = true; 
    3839                        propList.templateString = "<"+srcType+" class='"+src.className+"' dojoAttachPoint='"+(src.getAttribute("dojoAttachPoint")||'')+"' dojoAttachEvent='"+(src.getAttribute("dojoAttachEvent")||'')+"' >"+src.innerHTML.replace(/\%7B/g,"{").replace(/\%7D/g,"}")+"</"+srcType+">"; 
    3940                        // console.debug(propList.templateString); 
  • dijit/trunk/_Templated.js

    r10791 r10979  
    3838                containerNode: null, 
    3939 
     40                // skipNodeCache Boolean: 
     41                //              if using a cached widget template node poses issues for a 
     42                //              particular widget class, it can set this property to ensure 
     43                //              that its template is always re-built from a string 
     44                _skipNodeCache: false, 
     45 
    4046                // method over-ride 
    4147                buildRendering: function(){ 
     
    4652                        // isn't there already.  Returns either a DomNode or a string, depending on 
    4753                        // whether or not the template contains ${foo} replacement parameters. 
    48                         var cached = dijit._Templated.getCachedTemplate(this.templatePath, this.templateString); 
     54                        var cached = dijit._Templated.getCachedTemplate(this.templatePath, this.templateString, this._skipNodeCache); 
    4955 
    5056                        var node; 
     
    5662                                        if(key.charAt(0) == '!'){ value = _this[key.substr(1)]; } 
    5763                                        if(typeof value == "undefined"){ throw new Error(className+" template:"+key); } // a debugging aide 
     64                                        if(!value){ return ""; } 
    5865 
    5966                                        // Substitution keys beginning with ! will skip the transform step, 
     
    189196dijit._Templated._templateCache = {}; 
    190197 
    191 dijit._Templated.getCachedTemplate = function(templatePath, templateString){ 
     198dijit._Templated.getCachedTemplate = function(templatePath, templateString, alwaysUseString){ 
    192199        // summary: 
    193200        //              static method to get a template based on the templatePath or 
     
    216223        templateString = dojo.string.trim(templateString); 
    217224 
    218         if(templateString.match(/\$\{([^\}]+)\}/g)){ 
     225        if(templateString.match(/\$\{([^\}]+)\}/g) || alwaysUseString){ 
    219226                // there are variables in the template so all we can do is cache the string 
    220227                return (tmplts[key] = templateString); //String