Uncaught HierarchyRequestError

I start with darts and polymer. When I run the web application in Chrome, I get:

Uncaught HierarchyRequestError: Failed to execute 'appendChild' on 'Node': Nodes of type 'HTML' may not be inserted inside nodes of type '#document'. patches-mdv.js:57
(anonymous function) patches-mdv.js:57
(anonymous function) patches-mdv.js:57
(anonymous function) patches-mdv.js:57

AppendChild is probably created in the dart2js code, namely in the following snippet:

  Node: {
    "^": "EventTarget;ownerDocument=,text:textContent=",
    remove$0: function(receiver) {
      var t1 = receiver.parentNode;
      if (t1 != null)
        J._removeChild$1$x(t1, receiver);
    },
    toString$0: function(receiver) {
      var t1 = receiver.nodeValue;
      return t1 == null ? J.Interceptor.prototype.toString$0.call(this, receiver) : t1;
    },
    append$1: function(receiver, newChild) {
      return receiver.appendChild(newChild);
    },
    insertBefore$2: function(receiver, newChild, refChild) {
      return receiver.insertBefore(newChild, refChild);
    },
    _removeChild$1: function(receiver, oldChild) {
      return receiver.removeChild(oldChild);
    },
    _replaceChild$2: function(receiver, newChild, oldChild) {
      return receiver.replaceChild(newChild, oldChild);
    },
    $isNode: true,
    "%": "DocumentType|Notation;Node"
  },

How to solve this?

+4
source share
1 answer

As stated at https://groups.google.com/a/dartlang.org/forum/#!msg/web/bgMajiu_iR4/rygd5Ftk668J , due to the symptoms, it seems that platform.js is loaded twice.

Therefore, remove the following two lines from each html except your toplevel index.html:

<script src="packages/web_components/platform.js"></script>
<script src="packages/web_components/dart_support.js"></script>

Update: With Polymer> 0.14.0 is platform.jsno longer needed. It is automatically added pub buildand pub serve.

+5
source

All Articles