开发者

Dojo Parser - Parsing completed?

Is there a way开发者_如何转开发 to find whether dojo has completed parsing when dojo.parse.parser(dom-id) was invoked to parse the document?

I don't want to rely on dojo.addOnLoad() as I am invoking parser on my own.


It's done a bit differently in Dojo 1.8:

... Dojo 1.8 can cause the parser to run in an asynchronous fashion ...

require(["dojo/parser", "dojo/_base/array"], function(parser, array){
  parser.parse().then(function(instances){
    array.forEach(instances, function(instance){
      // do something with instances
    });
  });
});

http://dojotoolkit.org/reference-guide/1.8/dojo/parser.html


I believe that invoking dojo.parser.parse is a synchronous call, meaning that the next line will only execute once that function has finished parsing widgets. Is there any particular reason to believe that code after dojo.parser.parse(node) is executing before the widgets in the dom are created?

Using the parseOnLoad: true property is another story though, which I don't believe is applicable in your case.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜