2014-08-07 2 views
4

Я новичок с дротиком и полимером. При запуске веб-приложения в Chrome я получаю:Uncaught HierarchyRequestError

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, вероятно, в сгенерированном коде dart2js, а именно в следующем куске:

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" 
    }, 

Как решить эту проблему?

ответ

5

Как говорится на https://groups.google.com/a/dartlang.org/forum/#!msg/web/bgMajiu_iR4/rygd5Ftk668J, из-за симптомов, похоже, что platform.js загружен дважды.

Так удалите следующие две строки из каждого HTML, кроме вашего верхнего уровня index.html:

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

Update: с полимерными> 0.14.0 platform.js не нужно больше. Он автоматически добавляется pub build и pub serve.

Смежные вопросы