<div dir="ltr">On Sun, May 21, 2017 at 6:32 PM, John Carlson <span dir="ltr"><<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_4633663232216230078WordSection1"><p class="MsoNormal">Yes, that’s what I’ve done.</p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">See:</p><p class="MsoNormal"><a href="https://coderextreme.net/X3DJSONLD/src/main/html/flipper2.html" target="_blank">https://coderextreme.net/<wbr>X3DJSONLD/src/main/html/<wbr>flipper2.html</a></p><p class="MsoNormal"><a href="https://coderextreme.net/X3DJSONLD/src/main/html/prototypes2.html" target="_blank">https://coderextreme.net/<wbr>X3DJSONLD/src/main/html/<wbr>prototypes2.html</a></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Only problem is, I’m loading the scene twice.</p><p class="MsoNormal"><u></u></p></div></div></blockquote><div><br></div><div>Ah, nice. Do you need the first <br><pre id="gmail-line1"><span>loadCobwebJS(json, 0) ?</span><br></pre></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_4633663232216230078WordSection1"><p class="MsoNormal"> <u></u></p><p class="MsoNormal">I’m thinking of writing a  two way channel so the JSON can notified of DOM events, and the DOM can get updated from JSON events.  Or two routes.  The channel serves as  two queues.  Anyone know something like this?</p><p class="MsoNormal"><u></u></p></div></div></blockquote><div><br></div><div>Not sure if there are JSON events. There might be a js library which mirrors a DOM in a json object, and vice versa. <a href="https://www.npmjs.com/package/domjson">https://www.npmjs.com/package/domjson</a> does some of it.  <br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_4633663232216230078WordSection1"><p class="MsoNormal"> <u></u></p><p class="MsoNormal">Also here are two pure JSON and pure XML examples from Cobweb, for your comparison.  If you have write privileges to the cobweb master, Andreas, you might want to consider integrating my changes. </p></div></div></blockquote><div><br></div><div>I pulled your latest cobweb master branch into a branch of my own cobweb fork.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_4633663232216230078WordSection1"><p class="MsoNormal">You can now specify X3D JSON files as URLs in Cobweb (BIG ADVANCE!)</p></div></div></blockquote><div><br></div><div>Looks good.<br><br></div><div>-Andreas<br></div><div><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_4633663232216230078WordSection1"><div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(225,225,225) currentcolor currentcolor;padding:3pt 0in 0in"><p class="MsoNormal" style="border-width:medium;border-style:none;border-color:currentcolor;padding:0in"><b>From: </b><a href="mailto:andreasplesch@gmail.com" target="_blank">Andreas Plesch</a><br><b>Sent: </b>Sunday, May 21, 2017 1:14 PM<br><b>To: </b><a href="mailto:yottzumm@gmail.com" target="_blank">John Carlson</a><br><b>Cc: </b><a href="mailto:Leonard.Daly@realism.com" target="_blank">Leonard Daly</a>; <a href="mailto:x3d-public@web3d.org" target="_blank">X3D Graphics public mailing list</a>; <a href="mailto:x3dom-users@lists.sourceforge.net" target="_blank">x3dom-users@lists.sourceforge.<wbr>net</a><br><b>Subject: </b>RE: Cobweb_dom...Script Magic?<wbr>LoadingDOMsubscenesafterparent<wbr>inX3DOMand Cobweb.</p></div><p class="MsoNormal"><u></u> <u></u></p><div><div><div><div><p class="MsoNormal">On May 21, 2017 12:26 PM, "John Carlson" <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:</p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in"><div><div><p class="MsoNormal">Okay, I don’t have mutation observers yet.  I though I would share working pages that don’t meet the goals yet.</p></div></div></blockquote></div></div></div><div><p class="MsoNormal">Ok. The question was if using mutation observers would help in achieving a sequenced loading of first a main scene and then (JSON encoded) content as children of a (global) group. I think they might.</p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Here is another thought. Why not first assemble a complete scene in JSON, or more precisely as the javascript object derived from the JSON ? Rather than assemble in the DOM ? It should be easy to add children to a JSON object ?</p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">One of the advantages of having a JSON encoding is that as a native javascript object it will be easy to manipulate (and then load into the DOM, and then as x3d nodes)</p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Andreas</p></div><div><div><div><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in"><div><div><p class="MsoNormal"> is the X3D JSON PROTO expander in action folks. The first page incorporates a proto expanded box scene placed over a flipper scene, in both Cobweb and X3DOM</p><div><p class="MsoNormal"> </p><p class="MsoNormal"><a href="https://coderextreme.net/X3DJSONLD/src/main/html/flipper.html" target="_blank">https://coderextreme.net/<wbr>X3DJSONLD/src/main/html/<wbr>flipper.html</a></p><p class="MsoNormal"> </p><p class="MsoNormal">The second shows two combined proto expanded scenes, one with proto expanded VRMLscripts </p></div><p class="MsoNormal"><a href="https://coderextreme.net/X3DJSONLD/src/main/html/prototypes.html" target="_blank">https://coderextreme.net/<wbr>X3DJSONLD/src/main/html/<wbr>prototypes.html</a> both in Cobweb and X3DOM.</p><div><p class="MsoNormal">The source X3D JSON sitting on the file system has PROTOs, please confirm.  You may need to press the reload X3DOM button.</p><p class="MsoNormal"> </p><p class="MsoNormal"><a href="https://coderextreme.net/X3DJSONLD/src/main/data/abox.json" target="_blank">https://coderextreme.net/<wbr>X3DJSONLD/src/main/data/abox.<wbr>json</a></p></div><p class="MsoNormal"><a href="https://coderextreme.net/X3DJSONLD/src/main/data/asmallbox.json" target="_blank">https://coderextreme.net/<wbr>X3DJSONLD/src/main/data/<wbr>asmallbox.json</a></p><p class="MsoNormal"><a href="https://coderextreme.net/X3DJSONLD/src/main/data/cobweb.json" target="_blank">https://coderextreme.net/<wbr>X3DJSONLD/src/main/data/<wbr>cobweb.json</a></p><p class="MsoNormal"> </p><p class="MsoNormal">You can try these files and others in the X3D JSON Loader (X3DJSONLD):</p><p class="MsoNormal"> </p><p class="MsoNormal"><a href="https://coderextreme.net/X3DJSONLD/" target="_blank">https://coderextreme.net/<wbr>X3DJSONLD/</a></p><p class="MsoNormal"> </p><p class="MsoNormal">ExternProtos do not work on <a href="http://coderextreme.net" target="_blank">coderextreme.net</a>, and my server is currently in shreds when converting files in /c/x3d-code/<a href="http://www.web3d.org" target="_blank">www.web3d.org</a>, but I think I almost have extern proto expander working on the client.  More to follow, just wanted to share some results.</p><p class="MsoNormal"> </p><p class="MsoNormal">Plus I am starting to move towards a more standard way of programming JavaScript.</p><div><p class="MsoNormal"> </p><p class="MsoNormal">John </p><p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986" target="_blank">Mail</a> for Windows 10</p><p class="MsoNormal"> </p><div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(225,225,225) currentcolor currentcolor;padding:3pt 0in 0in"><p class="MsoNormal"><b>From: </b><a href="mailto:andreasplesch@gmail.com" target="_blank">Andreas Plesch</a><br><b>Sent: </b>Sunday, May 21, 2017 7:29 AM<br><b>To: </b><a href="mailto:yottzumm@gmail.com" target="_blank">John Carlson</a><br><b>Subject: </b>RE: Cobweb_dom...Script Magic? Loading DOMsubscenesafterparentinX3DOM<wbr>and Cobweb.</p></div><p class="MsoNormal"> </p><div><p class="MsoNormal">That's because I mentioned observers which are more efficient than the mutation events. Leonard provided the link to the mdn documentation and here is where I install them in cobweb_dom:</p><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal"><a href="https://github.com/andreasplesch/cobweb_dom/blob/master/cobweb/cobweb_dom.js#L79" target="_blank">https://github.com/<wbr>andreasplesch/cobweb_dom/blob/<wbr>master/cobweb/cobweb_dom.js#<wbr>L79</a></p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">Andreas</p></div></div><div><p class="MsoNormal"> </p><div><p class="MsoNormal">On May 20, 2017 11:44 PM, "John Carlson" <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:</p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><div><div><p class="MsoNormal" style="margin-left:4.8pt"><a href="https://github.com/search?utf8=%E2%9C%93&q=DOMNodeInserted+user%3Aandreasplesch+extension%3Ajs&type=Code&ref=advsearch&l=&l" target="_blank">https://github.com/search?<wbr>utf8=%E2%9C%93&q=<wbr>DOMNodeInserted+user%<wbr>3Aandreasplesch+extension%<wbr>3Ajs&type=Code&ref=advsearch&<wbr>l=&l</a>=</p><p class="MsoNormal" style="margin-left:4.8pt"> </p><p class="MsoNormal" style="margin-left:4.8pt">Returns nothing.</p><p class="MsoNormal" style="margin-left:4.8pt"> </p><p class="MsoNormal" style="margin-left:4.8pt">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986" target="_blank">Mail</a> for Windows 10</p><p class="MsoNormal" style="margin-left:4.8pt"> </p><div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(225,225,225) currentcolor currentcolor;padding:3pt 0in 0in"><p class="MsoNormal" style="margin-left:4.8pt"><b>From: </b><a href="mailto:yottzumm@gmail.com" target="_blank">John Carlson</a><br><b>Sent: </b>Saturday, May 20, 2017 11:43 PM<br><b>To: </b><a href="mailto:andreasplesch@gmail.com" target="_blank">Andreas Plesch</a><br><b>Cc: </b><a href="mailto:x3dom-users@lists.sourceforge.net" target="_blank">x3dom mlist</a>; <a href="mailto:x3d-public@web3d.org" target="_blank">X3D Graphics public mailing list</a>; <a href="mailto:holger.seelig@yahoo.de" target="_blank">holger.seelig@yahoo.de</a><br><b>Subject: </b>RE: Cobweb_dom...Script Magic? Loading DOMsubscenesafterparentinX3DOM and Cobweb.</p></div><p class="MsoNormal" style="margin-left:4.8pt"> </p><p class="MsoNormal" style="margin-left:4.8pt">And I guess this would only work where there’s a single tag like Scene, unless you disabled the event after the if clause.</p><p class="MsoNormal" style="margin-left:4.8pt"> </p><p class="MsoNormal" style="margin-left:4.8pt">Can you give me a link to where your code does DOMNodeInserted.</p><p class="MsoNormal" style="margin-left:4.8pt"> </p><p class="MsoNormal" style="margin-left:4.8pt">John</p><p class="MsoNormal" style="margin-left:4.8pt"> </p><p class="MsoNormal" style="margin-left:4.8pt">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986" target="_blank">Mail</a> for Windows 10</p><p class="MsoNormal" style="margin-left:4.8pt"> </p><div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(225,225,225) currentcolor currentcolor;padding:3pt 0in 0in"><p class="MsoNormal" style="margin-left:4.8pt"><b>From: </b><a href="mailto:yottzumm@gmail.com" target="_blank">John Carlson</a><br><b>Sent: </b>Saturday, May 20, 2017 11:33 PM<br><b>To: </b><a href="mailto:andreasplesch@gmail.com" target="_blank">Andreas Plesch</a><br><b>Cc: </b><a href="mailto:x3dom-users@lists.sourceforge.net" target="_blank">x3dom mlist</a>; <a href="mailto:x3d-public@web3d.org" target="_blank">X3D Graphics public mailing list</a>; <a href="mailto:holger.seelig@yahoo.de" target="_blank">holger.seelig@yahoo.de</a><br><b>Subject: </b>RE: Cobweb_dom...Script Magic? Loading DOM subscenesafterparentinX3DOM and Cobweb.</p></div><p class="MsoNormal" style="margin-left:4.8pt"> </p><p class="MsoNormal" style="margin-left:4.8pt">Yes, but if I put that (what is it?) on my top level object, will I get a ton of events?  How would I observe when my  Scene node, for example, is added to my DOM?  Or my 200<sup>th</sup> Group node?</p><p class="MsoNormal" style="margin-left:4.8pt"> </p><p class="MsoNormal" style="margin-left:4.8pt">I’m  assuming I do something like:</p><p class="MsoNormal" style="margin-left:4.8pt"> </p><div><pre style="background:rgb(239,240,241) none repeat scroll 0% 0%;vertical-align:baseline"><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pln"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">$</span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pun"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">(</span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pln"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">document</span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pun"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">).</span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pln"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">on</span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pun"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">(</span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951str"><span style="font-family:"Times New Roman",serif;color:rgb(125,39,39);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">'<wbr>DOMNodeInserted'</span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pun"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">,</span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pln"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%"> </span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951kwd"><span style="font-family:"Times New Roman",serif;color:rgb(16,16,148);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">function</span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pun"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">(</span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pln"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">e</span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pun"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">)</span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pln"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%"> </span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pun"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">{</span></span></pre><pre style="background:rgb(239,240,241) none repeat scroll 0% 0%;vertical-align:baseline"><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pln"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">    if ($</span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pun"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">(</span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pln"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">e</span></span><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pun"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">.target) == document.querySelector(“Scene”<wbr>)) {</span></span></pre><pre style="background:rgb(239,240,241) none repeat scroll 0% 0%;vertical-align:baseline"><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pun"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">                    /* add child scene graph */;</span></span></pre><pre style="background:rgb(239,240,241) none repeat scroll 0% 0%;vertical-align:baseline"><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pun"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">    }</span></span></pre><pre style="background:rgb(239,240,241) none repeat scroll 0% 0%;vertical-align:baseline"><span class="gmail-m_4633663232216230078m1639301870588577057m-6560363753014162951pun"><span style="font-family:"Times New Roman",serif;color:rgb(48,51,54);border-width:1pt;border-style:none;border-color:windowtext;padding:0in;background:rgb(239,240,241) none repeat scroll 0% 0%">});</span></span></pre></div><p class="MsoNormal" style="margin-left:4.8pt"> </p><p class="MsoNormal" style="margin-left:4.8pt">Is this possible?  Can I query in the event?</p><p class="MsoNormal" style="margin-left:4.8pt"> </p><p class="MsoNormal" style="margin-left:4.8pt">Thanks,</p><p class="MsoNormal" style="margin-left:4.8pt"> </p><p class="MsoNormal" style="margin-left:4.8pt">John</p><p class="MsoNormal" style="margin-left:4.8pt"> </p><p class="MsoNormal" style="margin-left:4.8pt">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986" target="_blank">Mail</a> for Windows 10</p><p class="MsoNormal" style="margin-left:4.8pt"> </p><div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(225,225,225) currentcolor currentcolor;padding:3pt 0in 0in"><p class="MsoNormal" style="margin-left:4.8pt"><b>From: </b><a href="mailto:andreasplesch@gmail.com" target="_blank">Andreas Plesch</a><br><b>Sent: </b>Saturday, May 20, 2017 11:21 PM<br><b>To: </b><a href="mailto:yottzumm@gmail.com" target="_blank">John Carlson</a><br><b>Cc: </b><a href="mailto:x3dom-users@lists.sourceforge.net" target="_blank">x3dom mlist</a>; <a href="mailto:x3d-public@web3d.org" target="_blank">X3D Graphics public mailing list</a>; <a href="mailto:holger.seelig@yahoo.de" target="_blank">holger.seelig@yahoo.de</a><br><b>Subject: </b>RE: Cobweb_dom...Script Magic? Loading DOM subscenes afterparentinX3DOM and Cobweb.</p></div><p class="MsoNormal" style="margin-left:4.8pt"> </p><div><p class="MsoNormal" style="margin-left:4.8pt">There are observers which can observe mutations to an element including the addition of child elements.</p><div><p class="MsoNormal" style="margin-left:4.8pt"> </p></div><div><p class="MsoNormal" style="margin-left:4.8pt">This is what I use for cobweb_dom.</p></div><div><p class="MsoNormal" style="margin-left:4.8pt"> </p></div><div><p class="MsoNormal" style="margin-left:4.8pt">Andreas</p></div></div><div><p class="MsoNormal" style="margin-left:4.8pt"> </p><div><p class="MsoNormal" style="margin-left:4.8pt">On May 20, 2017 8:54 PM, "John Carlson" <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:</p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><div><div><p class="MsoNormal" style="margin-left:19.2pt">Ideally, I’d like to specify a CSS querySelector and get an event if an element a querySelector refers to is loaded into DOM.</p><p class="MsoNormal" style="margin-left:19.2pt"> </p><p class="MsoNormal" style="margin-left:19.2pt">Yeah, I can use a timeout or interval timer.  Sucks!</p><p class="MsoNormal" style="margin-left:19.2pt"> </p><p class="MsoNormal" style="margin-left:19.2pt">Is there an</p><p class="MsoNormal" style="margin-left:19.2pt"> </p><p class="MsoNormal" style="margin-left:19.2pt">Element.addEventQuerySelector(<wbr>) call?  It should be added!</p><p class="MsoNormal" style="margin-left:19.2pt"> </p><p class="MsoNormal" style="margin-left:19.2pt">Thanks,</p><p class="MsoNormal" style="margin-left:19.2pt"><br>John</p><p class="MsoNormal" style="margin-left:19.2pt"> </p><p class="MsoNormal" style="margin-left:19.2pt">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986" target="_blank">Mail</a> for Windows 10</p><p class="MsoNormal" style="margin-left:19.2pt"> </p><div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(225,225,225) currentcolor currentcolor;padding:3pt 0in 0in"><p class="MsoNormal" style="margin-left:19.2pt"><b>From: </b><a href="mailto:yottzumm@gmail.com" target="_blank">John Carlson</a><br><b>Sent: </b>Saturday, May 20, 2017 8:46 PM<br><b>To: </b><a href="mailto:andreasplesch@gmail.com" target="_blank">Andreas Plesch</a><br><b>Cc: </b><a href="mailto:holger.seelig@yahoo.de" target="_blank">holger.seelig@yahoo.de</a>; <a href="mailto:x3d-public@web3d.org" target="_blank">X3D Graphics public mailing list</a>; <a href="mailto:x3dom-users@lists.sourceforge.net" target="_blank">x3dom-users@lists.sourceforge.<wbr>net</a><br><b>Subject: </b>RE: Cobweb_dom...Script Magic? Loading DOM subscenes after parentinX3DOM and Cobweb.</p></div><p class="MsoNormal" style="margin-left:19.2pt"> </p><p class="MsoNormal" style="margin-left:19.2pt">I would like to separate the main scene loading from the sub scene loading, so I can load many, many subscenes, plus it will make coding easier.</p><p class="MsoNormal" style="margin-left:19.2pt"> </p><p class="MsoNormal" style="margin-left:19.2pt">I am almost able to do that, but I am not sure when the Scene object loads in the main scene.</p><p class="MsoNormal" style="margin-left:19.2pt"> </p><p class="MsoNormal" style="margin-left:19.2pt">What wasn’t working before was that the child scene was added before it displayed in Cobweb.  That has been fixed now.</p><p class="MsoNormal" style="margin-left:19.2pt"> </p><p class="MsoNormal" style="margin-left:19.2pt">It’s an Inline, but not in typical X3D parlance.  It’s a DOM object added afterwards, by using a selector on the DOM.</p><p class="MsoNormal" style="margin-left:19.2pt"> </p><p class="MsoNormal" style="margin-left:19.2pt">I can expand prototypes inline, as the example now shows.  That’s not a problem, really.  I just want to make a way NOT to expand PROTOs for Cobweb.</p><p class="MsoNormal" style="margin-left:19.2pt"> </p><p class="MsoNormal" style="margin-left:19.2pt">Yes, I am loading X3DJSON into Cobweb AND X3DOM, using the same DOM tree (probably not a good idea).</p><p class="MsoNormal" style="margin-left:19.2pt"> </p><p class="MsoNormal" style="margin-left:19.2pt">Yes, I am interested in your DOM event which is dispatched when a Scene is fully loaded.  Could you go and check?  Thanks!</p><p class="MsoNormal" style="margin-left:19.2pt"> </p><p class="MsoNormal" style="margin-left:19.2pt">John</p><p class="MsoNormal" style="margin-left:19.2pt"> </p><p class="MsoNormal" style="margin-left:19.2pt">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986" target="_blank">Mail</a> for Windows 10</p><p class="MsoNormal" style="margin-left:19.2pt"> </p><div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(225,225,225) currentcolor currentcolor;padding:3pt 0in 0in"><p class="MsoNormal" style="margin-left:19.2pt"><b>From: </b><a href="mailto:andreasplesch@gmail.com" target="_blank">Andreas Plesch</a><br><b>Sent: </b>Saturday, May 20, 2017 8:21 PM<br><b>To: </b><a href="mailto:yottzumm@gmail.com" target="_blank">John Carlson</a><br><b>Cc: </b><a href="mailto:holger.seelig@yahoo.de" target="_blank">holger.seelig@yahoo.de</a>; <a href="mailto:x3d-public@web3d.org" target="_blank">X3D Graphics public mailing list</a>; <a href="mailto:x3dom-users@lists.sourceforge.net" target="_blank">x3dom-users@lists.sourceforge.<wbr>net</a><br><b>Subject: </b>Re: Cobweb_dom...Script Magic? Loading DOM subscenes after parent inX3DOM and Cobweb.</p></div><p class="MsoNormal" style="margin-left:19.2pt"> </p><div><p class="MsoNormal" style="margin-left:19.2pt">Hi John,</p><div><p class="MsoNormal" style="margin-left:19.2pt"> </p></div><div><p class="MsoNormal" style="margin-left:19.2pt">it is difficult for me to see what is not working, in the example. It looks like it is working but only by using callbacks in custom methods and you would rather use Promises in reusable fashion ?</p></div><div><p class="MsoNormal" style="margin-left:19.2pt"> </p></div><div><p class="MsoNormal" style="margin-left:19.2pt">By child DOM scenegraph, do you mean a scene which is added as an Inline to another (parent) scene ? Hm. it looks more like an appended Transform group which would be quite different.</p></div><div><p class="MsoNormal" style="margin-left:19.2pt"> </p></div><div><p class="MsoNormal" style="margin-left:19.2pt">I think for cobweb_dom I added a dom event which is dispatched when an Inline or Scene is fully loaded but I would have to go back and check. Events would be another way to guarantee a sequence of loading.</p></div><div><p class="MsoNormal" style="margin-left:19.2pt"> </p></div><div><p class="MsoNormal" style="margin-left:19.2pt">jquery xhr and regular xhr have mechanisms to allow acting on when a request is fulfilled (which is I think what you are using).</p></div><div><p class="MsoNormal" style="margin-left:19.2pt"> </p></div><div><p class="MsoNormal" style="margin-left:19.2pt">It may be necessary to come up with a minimal, non-working example which shows the issue. Is dealing with expanding prototypes related to sequencing ?</p></div><div><p class="MsoNormal" style="margin-left:19.2pt"> </p></div><div><p class="MsoNormal" style="margin-left:19.2pt">I think you are also trying to show how to load json encoded x3d with x3dom and cobweb ?</p></div><div><p class="MsoNormal" style="margin-left:19.2pt"> </p></div><div><p class="MsoNormal" style="margin-left:19.2pt">Sorry to be of no more constructive help, eg. asking all the returned questions,</p></div><div><p class="MsoNormal" style="margin-left:19.2pt"> </p></div><div><p class="MsoNormal" style="margin-left:19.2pt">Andreas</p></div><div><p class="MsoNormal" style="margin-left:19.2pt"> </p></div><div><p class="MsoNormal" style="margin-left:19.2pt"> </p><div><p class="MsoNormal" style="margin-left:19.2pt">On Sat, May 20, 2017 at 5:23 PM, John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:</p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><div><div><p class="MsoNormal" style="margin-left:38.4pt">Cobweb_dom, X3DOM experts, I need some help adding a child DOM scenegraph with prototypes to a parent DOM scenegraph after the primary scene has been  loaded, and not before. I have an example of loading before the scene is loaded, and in a callback.  If you have an example with Promises instead of callback nesting, that would be more ideal, the second $.getJSON() (child scenegraph) might finish before the first $.getJSON() (parent scenegraph) if I don’t use promises or callback nesting. Also, Promises would allow me to separate the parent loading somewhat from the child loading, and create separate functions.  Also, X3DOM experts can provide an example with Promises as well.  Meanwhile, I will be reading about Promises.</p><p class="MsoNormal" style="margin-left:38.4pt"> </p><p class="MsoNormal" style="margin-left:38.4pt">Here is my example so far:</p><p class="MsoNormal" style="margin-left:38.4pt"><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html" target="_blank">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/html/flipper.<wbr>html</a><br><br>Viewable here:</p><p class="MsoNormal" style="margin-left:38.4pt"><a href="https://coderextreme.net/X3DJSONLD/src/main/html/flipper.html" target="_blank">https://coderextreme.net/<wbr>X3DJSONLD/src/main/html/<wbr>flipper.html</a></p><p class="MsoNormal" style="margin-left:38.4pt"> </p><p class="MsoNormal" style="margin-left:38.4pt">The white Box is the subscene of the dolphin scene.</p><p class="MsoNormal" style="margin-left:38.4pt"> </p><p class="MsoNormal" style="margin-left:38.4pt">The following related code is from <a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/loaderJQuery.js" target="_blank">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/node/<wbr>loaderJQuery.js</a></p><p class="MsoNormal" style="margin-left:38.4pt">and references code from:</p><p class="MsoNormal" style="margin-left:38.4pt"> </p><p class="MsoNormal" style="margin-left:38.4pt"><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/X3DJSONLD.js" target="_blank">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/node/<wbr>X3DJSONLD.js</a></p><p class="MsoNormal" style="margin-left:38.4pt">[ actually, I think the last two reference each other – naughty ]</p><p class="MsoNormal" style="margin-left:38.4pt"> </p><p class="MsoNormal" style="margin-left:38.4pt">Data is here:</p><p class="MsoNormal" style="margin-left:38.4pt">[ child scenegraph ]</p><p class="MsoNormal" style="margin-left:38.4pt"><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/abox.json" target="_blank">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/data/abox.json</a></p><p class="MsoNormal" style="margin-left:38.4pt"> </p><p class="MsoNormal" style="margin-left:38.4pt">[ parent scenegraph ]</p><p class="MsoNormal" style="margin-left:38.4pt"><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/flipp.json" target="_blank">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/data/flipp.<wbr>json</a></p><p class="MsoNormal" style="margin-left:38.4pt"> </p><p class="MsoNormal" style="margin-left:38.4pt"> </p><p class="MsoNormal" style="margin-left:38.4pt">Cobweb doesn’t need the prototypeExpander or the flattener (well, it might have with prototypes in cobweb_dom, but I think the last release fixed that…haven’t checked—here is a good test for you!).  This is a dual example, and I haven’t figured out how to conditionally run the prototypeExpander on only X3DOM code.  Please test without the PrototypeExpander.js and Flattener.js included, and remove X3DOM, since it won’t work in that case.  X3DOM folks can include the two JavaScript files which are here:</p><p class="MsoNormal" style="margin-left:38.4pt"> </p><p class="MsoNormal" style="margin-left:38.4pt"><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/PrototypeExpander.js" target="_blank">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/node/<wbr>PrototypeExpander.js</a></p><p class="MsoNormal" style="margin-left:38.4pt"><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Flattener.js" target="_blank">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/node/<wbr>Flattener.js</a></p><p class="MsoNormal" style="margin-left:38.4pt"> </p><p class="MsoNormal" style="margin-left:38.4pt"> </p><p class="MsoNormal" style="margin-left:38.4pt">You may provide your own appendInline (below) which doesn’t call loadSchema.  That may be too complex of a download.  That is, you probably don’t want to do all that JSON schema validation in your example.  Try to keep my code close to what it is otherwise.</p><p class="MsoNormal" style="margin-left:38.4pt"> </p><p class="MsoNormal" style="margin-left:38.4pt">And if you start supporting X3D JSON in your viewers, that would be even better!</p><p class="MsoNormal" style="margin-left:38.4pt"> </p><p class="MsoNormal" style="margin-left:38.4pt">John</p><p class="MsoNormal" style="margin-left:38.4pt"> </p><p class="MsoNormal" style="margin-left:38.4pt">/**</p><p class="MsoNormal" style="margin-left:74.4pt"><span style="font-size:10pt;font-family:Symbol">·</span><span style="font-size:7pt;font-family:"Times New Roman",serif">         </span>Next is passed the element parameter</p><p class="MsoNormal" style="margin-left:74.4pt"><span style="font-size:10pt;font-family:Symbol">·</span><span style="font-size:7pt;font-family:"Times New Roman",serif">         </span>*/</p><p class="MsoNormal" style="margin-left:38.4pt">function appendInline(element, url, next) {</p><p class="MsoNormal" style="margin-left:38.4pt">        $.getJSON(url, function(json) {</p><p class="MsoNormal" style="margin-left:38.4pt">                if (typeof prototypeExpander === 'function') {</p><p class="MsoNormal" style="margin-left:38.4pt">                        json = prototypeExpander(url, json, "");</p><p class="MsoNormal" style="margin-left:38.4pt">                } else {</p><p class="MsoNormal" style="margin-left:38.4pt">                        console.error("Perhaps you need to include the PrototypeExpander.js?");</p><p class="MsoNormal" style="margin-left:38.4pt">                }</p><p class="MsoNormal" style="margin-left:38.4pt">                if (typeof flattener === 'function') {</p><p class="MsoNormal" style="margin-left:38.4pt">                        json = flattener(json);</p><p class="MsoNormal" style="margin-left:38.4pt">                } else {</p><p class="MsoNormal" style="margin-left:38.4pt">                        console.error("Perhaps you need to include the Flattener.js?");</p><p class="MsoNormal" style="margin-left:38.4pt">                }</p><p class="MsoNormal" style="margin-left:38.4pt">                // must validate here because we call an inner method.</p><p class="MsoNormal" style="margin-left:38.4pt">                loadSchema(json, url, doValidate, function() {</p><p class="MsoNormal" style="margin-left:38.4pt">                        ConvertToX3DOM(json["X3D"]["<wbr>Scene"], "Scene", element, url);</p><p class="MsoNormal" style="margin-left:38.4pt">                        next(element);</p><p class="MsoNormal" style="margin-left:38.4pt">                }, function(e) {</p><p class="MsoNormal" style="margin-left:38.4pt">                        console.error(e);</p><p class="MsoNormal" style="margin-left:38.4pt">                });</p><p class="MsoNormal" style="margin-left:38.4pt">        }).fail(function(jqXHR, textStatus, errorThrown) { alert('getJSON request failed! ' + textStatus + ' ' + errorThrown); });</p><p class="MsoNormal" style="margin-left:38.4pt">}</p><p class="MsoNormal" style="margin-left:38.4pt"> </p><p class="MsoNormal" style="margin-left:38.4pt">/**</p><p class="MsoNormal" style="margin-left:74.4pt"><span style="font-size:10pt;font-family:Symbol">·</span><span style="font-size:7pt;font-family:"Times New Roman",serif">         </span>Next is passed the selected element from selector</p><p class="MsoNormal" style="margin-left:74.4pt"><span style="font-size:10pt;font-family:Symbol">·</span><span style="font-size:7pt;font-family:"Times New Roman",serif">         </span>Selector is the CSS selector to append inline to.</p><p class="MsoNormal" style="margin-left:74.4pt"><span style="font-size:10pt;font-family:Symbol">·</span><span style="font-size:7pt;font-family:"Times New Roman",serif">         </span>*/</p><p class="MsoNormal" style="margin-left:38.4pt">function loadSubscene(selector, url, next) {</p><p class="MsoNormal" style="margin-left:38.4pt">        appendInline(document.<wbr>querySelector(selector), url, next);</p><p class="MsoNormal" style="margin-left:38.4pt">}</p></div></div></blockquote></div><p class="MsoNormal" style="margin-left:19.2pt"><br><br clear="all"></p><div><p class="MsoNormal" style="margin-left:19.2pt"> </p></div><p class="MsoNormal" style="margin-left:19.2pt">-- </p></div></div><p class="MsoNormal" style="margin-left:19.2pt">Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</p><p class="MsoNormal" style="margin-left:19.2pt"> </p></div></div></blockquote></div></div><p class="MsoNormal" style="margin-left:9.6pt"> </p><p class="MsoNormal" style="margin-left:4.8pt"> </p><p class="MsoNormal" style="margin-left:4.8pt"> </p></div></div></blockquote></div></div><p class="MsoNormal" style="margin-left:4.8pt"> </p><p class="MsoNormal"> </p><p class="MsoNormal"> </p></div></div></div></blockquote></div></div></div></div><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p></div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</div>
</div></div>