3
试图找出为什么我无法在我的dojo构建中实习字符串。我的图层文件被正确创建,但与每个单独的dijits相关的代码没有正确执行。自定义Dojo构建字符串的问题
这里是一块构建输出的一部分,说明它失败:
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
它看起来因为模板没有得到正确添加到js文件,如优化失败。这是js在html被实现后的样子。你不能从输出中看出来,但是在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");
}
});
}
该htm文件非常简单,所以我不认为这是我的问题的根源。
<div dojoAttachPoint="containerNode">
<div dojoattachpoint="_outerDiv">
<div dojoattachpoint="_addPoint" dojotype="dijit.form.Button" dojoattachevent="onClick:_addPointComment"><b>Add Comment</b></div>
</div>
</div>
有什么建议吗?
您确定它与templateString的实习有关吗?如果将dojo.cache语句替换为“
你说得对,即使我替换了dojo.cache语句,我仍然得到错误。任何想法可能是什么问题? – wrdaigle
不,很难分辨。你绝对确定你的commenting.js没有任何奇怪的隐形角色?如果您禁用注释剥离或其他一些优化,它是否也会发生? – Frode