gpt4 book ai didi

dart - 未捕获的层次结构请求错误

转载 作者:行者123 更新时间:2023-12-05 01:03:09 25 4
gpt4 key购买 nike

我是 Dart 和聚合物的初学者。当我在 Chrome 中运行网络应用程序时,我得到:

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

我该如何解决这个问题?

最佳答案

正如 https://groups.google.com/a/dartlang.org/forum/#!msg/web/bgMajiu_iR4/rygd5Ftk668J 上所说,从症状来看,platform.js 已经加载了两次。

因此,从除顶层 index.html 之外的每个 html 中删除以下两行:

<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 .

关于dart - 未捕获的层次结构请求错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25190771/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com