首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无光HierarchyRequestError

问无光HierarchyRequestError
EN

Stack Overflow用户
提问于 2014-08-07 19:35:46
回答 1查看 2K关注 0票数 4

我是飞镖和聚合物的初学者。当我用Chrome运行web应用程序时,我得到:

代码语言:javascript
复制
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代码中,即在以下部分:

代码语言:javascript
复制
  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"
  },

我该怎么解决这个问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-08-07 21:36:10

正如在iR4/rygd5Ftk668J上所说的,从症状来看,platform.js似乎已经加载了两次。

因此,除toplevel index.html外,从每个html中删除以下两行:

代码语言:javascript
复制
<script src="packages/web_components/platform.js"></script>
<script src="packages/web_components/dart_support.js"></script>

更新:聚合物> 0.14.0,不再需要platform.js。它由pub build和pub serve自动添加。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25190771

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档