Fullscreen Elm App in 0.19 (childNode issue) Reopened again

This builds on

I noticed the same issue with the google maps webcomponent from polymer. The question raised by @evancz before was where in the dom tree are changes being made, and in this case the answer is ‘pretty random’ - you can see that in addition to adding children to the google-map element, a script tag has been inserted between two of the other children.

The lies in the way that IronJsonpLibraryBehavior is implemented, but I suspect is widely used in Polymer. The key code reads

  addScript: function(src) {
    var script = document.createElement('script');
    script.src = src;
    script.onerror = this.handleError.bind(this);
    var s = document.querySelector('script') || document.body;
    s.parentNode.insertBefore(script, s);
    this.script = script;

So the work around seems to be place a <script> tag somewhere in the html. Orherwise I suppose it is some sort of race condition that leads to placement of the script tag between two of the elm divs.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.