<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
span.m-6560363753014162951pln
        {mso-style-name:m_-6560363753014162951pln;}
span.m-6560363753014162951pun
        {mso-style-name:m_-6560363753014162951pun;}
span.m-6560363753014162951str
        {mso-style-name:m_-6560363753014162951str;}
span.m-6560363753014162951kwd
        {mso-style-name:m_-6560363753014162951kwd;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=EN-US link=blue vlink="#954F72"><div class=WordSection1><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.  This 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><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><a href="https://coderextreme.net/X3DJSONLD/src/main/html/flipper.html">https://coderextreme.net/X3DJSONLD/src/main/html/flipper.html</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The second shows two combined proto expanded scenes, one with proto expanded VRMLscripts <o:p></o:p></p><p class=MsoNormal><a href="https://coderextreme.net/X3DJSONLD/src/main/html/prototypes.html">https://coderextreme.net/X3DJSONLD/src/main/html/prototypes.html</a> both in Cobweb and X3DOM.<o:p></o:p></p><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.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><a href="https://coderextreme.net/X3DJSONLD/src/main/data/abox.json">https://coderextreme.net/X3DJSONLD/src/main/data/abox.json</a><o:p></o:p></p><p class=MsoNormal><a href="https://coderextreme.net/X3DJSONLD/src/main/data/asmallbox.json">https://coderextreme.net/X3DJSONLD/src/main/data/asmallbox.json</a><o:p></o:p></p><p class=MsoNormal><a href="https://coderextreme.net/X3DJSONLD/src/main/data/cobweb.json">https://coderextreme.net/X3DJSONLD/src/main/data/cobweb.json</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>You can try these files and others in the X3D JSON Loader (X3DJSONLD):<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><a href="https://coderextreme.net/X3DJSONLD/">https://coderextreme.net/X3DJSONLD/</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>ExternProtos do not work on coderextreme.net, and my server is currently in shreds when converting files in /c/x3d-code/www.web3d.org, but I think I almost have extern proto expander working on the client.  More to follow, just wanted to share some results.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Plus I am starting to move towards a more standard way of programming JavaScript.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>John <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">Mail</a> for Windows 10<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b>From: </b><a href="mailto:andreasplesch@gmail.com">Andreas Plesch</a><br><b>Sent: </b>Sunday, May 21, 2017 7:29 AM<br><b>To: </b><a href="mailto:yottzumm@gmail.com">John Carlson</a><br><b>Subject: </b>RE: Cobweb_dom...Script Magic? Loading DOMsubscenesafterparentinX3DOMand Cobweb.<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></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:<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><a href="https://github.com/andreasplesch/cobweb_dom/blob/master/cobweb/cobweb_dom.js#L79">https://github.com/andreasplesch/cobweb_dom/blob/master/cobweb/cobweb_dom.js#L79</a><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Andreas<o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On May 20, 2017 11:44 PM, "John Carlson" <<a href="mailto:yottzumm@gmail.com">yottzumm@gmail.com</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'><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?utf8=%E2%9C%93&q=DOMNodeInserted+user%3Aandreasplesch+extension%3Ajs&type=Code&ref=advsearch&l=&l</a>=<o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'>Returns nothing.<o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></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<o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 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.<o:p></o:p></p></div><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></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.<o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'>Can you give me a link to where your code does DOMNodeInserted.<o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'>John<o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></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<o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 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.<o:p></o:p></p></div><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></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?<o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'>I’m  assuming I do something like:<o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p><div><pre style='background:#EFF0F1;vertical-align:baseline'><span class=m-6560363753014162951pln><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>$</span></span><span class=m-6560363753014162951pun><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>(</span></span><span class=m-6560363753014162951pln><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>document</span></span><span class=m-6560363753014162951pun><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>).</span></span><span class=m-6560363753014162951pln><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>on</span></span><span class=m-6560363753014162951pun><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>(</span></span><span class=m-6560363753014162951str><span style='font-family:"Times New Roman",serif;color:#7D2727;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>'DOMNodeInserted'</span></span><span class=m-6560363753014162951pun><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>,</span></span><span class=m-6560363753014162951pln><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'> </span></span><span class=m-6560363753014162951kwd><span style='font-family:"Times New Roman",serif;color:#101094;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>function</span></span><span class=m-6560363753014162951pun><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>(</span></span><span class=m-6560363753014162951pln><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>e</span></span><span class=m-6560363753014162951pun><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>)</span></span><span class=m-6560363753014162951pln><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'> </span></span><span class=m-6560363753014162951pun><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>{</span></span></pre><pre style='background:#EFF0F1;vertical-align:baseline'><span class=m-6560363753014162951pln><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>    if ($</span></span><span class=m-6560363753014162951pun><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>(</span></span><span class=m-6560363753014162951pln><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>e</span></span><span class=m-6560363753014162951pun><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>.target) == document.querySelector(“Scene”)) {</span></span></pre><pre style='background:#EFF0F1;vertical-align:baseline'><span class=m-6560363753014162951pun><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>                    /* add child scene graph */;</span></span></pre><pre style='background:#EFF0F1;vertical-align:baseline'><span class=m-6560363753014162951pun><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>    }</span></span></pre><pre style='background:#EFF0F1;vertical-align:baseline'><span class=m-6560363753014162951pun><span style='font-family:"Times New Roman",serif;color:#303336;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1'>});</span></span></pre></div><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'>Is this possible?  Can I query in the event?<o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'>Thanks,<o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'>John<o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></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<o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 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.<o:p></o:p></p></div><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></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.<o:p></o:p></p><div><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p></div><div><p class=MsoNormal style='margin-left:4.8pt'>This is what I use for cobweb_dom.<o:p></o:p></p></div><div><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p></div><div><p class=MsoNormal style='margin-left:4.8pt'>Andreas<o:p></o:p></p></div></div><div><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></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:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'><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.<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'>Yeah, I can use a timeout or interval timer.  Sucks!<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'>Is there an<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'>Element.addEventQuerySelector() call?  It should be added!<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'>Thanks,<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'><br>John<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></p><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 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.net</a><br><b>Subject: </b>RE: Cobweb_dom...Script Magic? Loading DOM subscenes after parentinX3DOM and Cobweb.<o:p></o:p></p></div><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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.<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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.<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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.<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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.<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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.<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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).<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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!<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'>John<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></p><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 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.net</a><br><b>Subject: </b>Re: Cobweb_dom...Script Magic? Loading DOM subscenes after parent inX3DOM and Cobweb.<o:p></o:p></p></div><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></p><div><p class=MsoNormal style='margin-left:19.2pt'>Hi John,<o:p></o:p></p><div><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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 ?<o:p></o:p></p></div><div><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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.<o:p></o:p></p></div><div><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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.<o:p></o:p></p></div><div><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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).<o:p></o:p></p></div><div><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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 ?<o:p></o:p></p></div><div><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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 ?<o:p></o:p></p></div><div><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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,<o:p></o:p></p></div><div><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></p></div><div><p class=MsoNormal style='margin-left:19.2pt'>Andreas<o:p></o:p></p></div><div><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></p></div><div><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></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:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'><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.<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>Here is my example so far:<o:p></o:p></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/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html</a><br><br>Viewable here:<o:p></o:p></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/X3DJSONLD/src/main/html/flipper.html</a><o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>The white Box is the subscene of the dolphin scene.<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'> <o:p></o:p></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/coderextreme/X3DJSONLD/blob/master/src/main/node/loaderJQuery.js</a><o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>and references code from:<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'> <o:p></o:p></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/coderextreme/X3DJSONLD/blob/master/src/main/node/X3DJSONLD.js</a><o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>[ actually, I think the last two reference each other – naughty ]<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>Data is here:<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>[ child scenegraph ]<o:p></o:p></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/coderextreme/X3DJSONLD/blob/master/src/main/data/abox.json</a><o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>[ parent scenegraph ]<o:p></o:p></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/coderextreme/X3DJSONLD/blob/master/src/main/data/flipp.json</a><o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'> <o:p></o:p></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:<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'> <o:p></o:p></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/coderextreme/X3DJSONLD/blob/master/src/main/node/PrototypeExpander.js</a><o:p></o:p></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/coderextreme/X3DJSONLD/blob/master/src/main/node/Flattener.js</a><o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'> <o:p></o:p></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.<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>And if you start supporting X3D JSON in your viewers, that would be even better!<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>John<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>/**<o:p></o:p></p><p class=MsoNormal style='margin-left:74.4pt'><span style='font-size:10.0pt;font-family:Symbol'>·</span><span style='font-size:7.0pt;font-family:"Times New Roman",serif'>         </span>Next is passed the element parameter<o:p></o:p></p><p class=MsoNormal style='margin-left:74.4pt'><span style='font-size:10.0pt;font-family:Symbol'>·</span><span style='font-size:7.0pt;font-family:"Times New Roman",serif'>         </span>*/<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>function appendInline(element, url, next) {<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>        $.getJSON(url, function(json) {<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                if (typeof prototypeExpander === 'function') {<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                        json = prototypeExpander(url, json, "");<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                } else {<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                        console.error("Perhaps you need to include the PrototypeExpander.js?");<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                }<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                if (typeof flattener === 'function') {<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                        json = flattener(json);<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                } else {<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                        console.error("Perhaps you need to include the Flattener.js?");<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                }<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                // must validate here because we call an inner method.<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                loadSchema(json, url, doValidate, function() {<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                        ConvertToX3DOM(json["X3D"]["Scene"], "Scene", element, url);<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                        next(element);<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                }, function(e) {<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                        console.error(e);<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>                });<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>        }).fail(function(jqXHR, textStatus, errorThrown) { alert('getJSON request failed! ' + textStatus + ' ' + errorThrown); });<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>}<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>/**<o:p></o:p></p><p class=MsoNormal style='margin-left:74.4pt'><span style='font-size:10.0pt;font-family:Symbol'>·</span><span style='font-size:7.0pt;font-family:"Times New Roman",serif'>         </span>Next is passed the selected element from selector<o:p></o:p></p><p class=MsoNormal style='margin-left:74.4pt'><span style='font-size:10.0pt;font-family:Symbol'>·</span><span style='font-size:7.0pt;font-family:"Times New Roman",serif'>         </span>Selector is the CSS selector to append inline to.<o:p></o:p></p><p class=MsoNormal style='margin-left:74.4pt'><span style='font-size:10.0pt;font-family:Symbol'>·</span><span style='font-size:7.0pt;font-family:"Times New Roman",serif'>         </span>*/<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>function loadSubscene(selector, url, next) {<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>        appendInline(document.querySelector(selector), url, next);<o:p></o:p></p><p class=MsoNormal style='margin-left:38.4pt'>}<o:p></o:p></p></div></div></blockquote></div><p class=MsoNormal style='margin-left:19.2pt'><br><br clear=all><o:p></o:p></p><div><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></p></div><p class=MsoNormal style='margin-left:19.2pt'>-- <o:p></o:p></p></div></div><p class=MsoNormal style='margin-left:19.2pt'>Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453<o:p></o:p></p><p class=MsoNormal style='margin-left:19.2pt'> <o:p></o:p></p></div></div></blockquote></div></div><p class=MsoNormal style='margin-left:9.6pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p></div></div></blockquote></div></div><p class=MsoNormal style='margin-left:4.8pt'> <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>