AMD转换后的Dojo错误

时间:2016-01-24 23:59:50

标签: javascript dojo

让一堆通用的javascripts与AMD兼容,我遇到了一些阻碍进度的错误:

  • TypeError:registry.byId(...)未定义
  • TypeError:_3ff为null(也是_3f9)

跟踪错误“registry.byId()”会导致domConstruct.place(...),而像“_3ff is null”这样的错误似乎指向“domConstruct.place”行(content,dom.byId($)亲本));”建议所需的Id不可用....虽然模块都包括“dojo / domReady!”。

'dojo / dom-construct'是模块的列出依赖项,并且已创建domConstruct变量。

例如,此类错误的起点之一是<td>

content += '<td valign="middle" nowrap="nowrap" id="somethingBlahMessages">';
// calls a function in another module where a <div> is created and filled
// see below
setTimeout(require('js/somethingMessages').somethingMessagesInit(), 1);
content += '</td>';

// function from another module to create div and fill with data 
var content = '';
content += '<div id="somethingMessages"></div>';

domConstruct.place(content, dom.byId('somethingBlahMessages'));     
// fetch the data, functions down the line also use domConstruct.place/empty
somethingMessagesTimer = setTimeout(that.somethingMessagesGet(), 1);

应该添加到td #thingBlahMessages的内容没有到达那里。这是一个解析问题吗?

这一切都习惯于以非AMD方式工作,所以我也怀疑它是一个红鲱鱼,真正的错误是巧妙地伪装成树枝和树枝,我走过它...

编辑:我尝试只将我的一个脚本转换为AMD模块,并且这样做会在遇到domConstruct.place(堆栈)时立即失败并出现“_3f9 is null”TypeError跟踪在地方功能处结束)。

0 个答案:

没有答案