Unusual JavaScript for loop with xml in Blockly -


i'm working on project google's blockly, parts of documentation incomprehensible. can me understand end condition of following loop (xml = allxml[i])?

var allxml = blockly.xml.workspacetodom(workspace); var allcode = []; (var = 0, xml; xml = allxml[i]; i++) {   var headless = new blockly.workspace();   blockly.xml.domtoworkspace(headless, xml);   allcode.push(blockly.javascript.workspacetocode(headless));   headless.dispose(); } 

i imagine loop exit when allxml[i] undefined, how can iterate through xml object this? seems returning undefined , skipping loop entirely.

thanks help

definitions of function can found @ https://code.google.com/p/blockly/source/browse/trunk/core/xml.js?r=1614

and doc page pulled https://developers.google.com/blockly/custom-blocks/code-structure?hl=en

i not find code in repo on github, guess bit older example in docs.

but if have @ blockly.xml.workspacetodom() function's implementation, see similar thing there.

  var blocks = workspace.gettopblocks(true);   (var = 0, block; block = blocks[i]; i++) {     var element = blockly.xml.blocktodom_(block);     //...     xml.appendchild(element);   } 

the idea here iterate on branches of code. top block has no top connection (it starts new branch). gettopblocks() returns array {!array.<!blockly.block>}.

considering documentation showing in section parallel execution, think related fact, can have more unconnected branches of code... , exact implementation changed on time.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -