Problems interning strings for custom Dojo build

373 views Asked by At

Trying to figure out why I can't seem to intern strings in my dojo build. My layer files get created correctly, but the code associated with each of the individual dijits doesn't get interned properly.

Here is a piece of portion of the build output that illustrates where it is failing:

release:  Interning strings for : ../../release/fwijits5.31.2012/content/fwijits/optionalDijits/commenting.js
release:      ../../release/fwijits5.31.2012/content/fwijits/optionalDijits/templates/commenting.htm
release:  Optimizing (shrinksafe, stripConsole=normal) file: ../../release/fwijits5.31.2012/content/fwijits/optionalDijits/commenting.js
release:  Could not strip comments for file: ../../release/fwijits5.31.2012/content/fwijits/optionalDijits/commenting.js,

error: InternalError: illegal character

It looks like the optimize fails because the template doesn't get added to the js file properly. Here is what the js looks like after the html gets interned. You can't tell from the output, but a byunch of special characters get tacked on at the end of the javascript.

if(!dojo._hasResource["fwijits.optionalDijits.commenting"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["fwijits.optionalDijits.commenting"] = true;
dojo.provide("fwijits.optionalDijits.commenting");

dojo.require("dijit._Widget");
dojo.require("dijit._Templated");

dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.TabContainer");


//The main widget that gets returned to the browser
dojo.declare("fwijits.optionalDijits.commenting", [dijit.layout.ContentPane, dijit._Templated], {

  widgetsInTemplate: true,
  _earlyTemplatedStartup: true,
  templateString: dojo.cache("fwijits.optionalDijits", "templates/commenting.htm"),
  basePath: dojo.moduleUrl("fwijits.optionalDijits"),

  //This function contains all configurable parameters
  constructor: function(params){
    params = params ||{};
    this.inherited(arguments);
  },

  //This functions run on a "startup" call
  startup: function(){
    var _this = this;

    this.inherited(arguments);
  },

  _addPointComment:function(){
    console.debug("button clicked");
  }

});

}

The htm file is pretty simple, so I don't think it's the root of my problem.

<div dojoAttachPoint="containerNode">
  <div dojoattachpoint="_outerDiv">
    <div dojoattachpoint="_addPoint" dojotype="dijit.form.Button" dojoattachevent="onClick:_addPointComment"><b>Add Comment</b></div>
  </div>
</div> 

Any suggestions?

1

There are 1 answers

0
sma On

Which version of Dojo? There is a bug in the build system with interning strings that do not end in HTML or HTM, although I've never tried with HTM to know for sure.

Might be worth a check. I know this was fixed in 1.7 and backported to 1.8.

https://bugs.dojotoolkit.org/ticket/15867