DOMNodeInserted
当节点“被附加到”或“被附加”时调用事件?
我问这个是因为以下代码:
function AddTextToContainer () {
var textNode = document.createTextNode ("My text");
var container = document.getElementById ("container");
if (container.addEventListener) {
container.addEventListener ('DOMNodeInserted', OnNodeInserted, false);
}
container.appendChild (textNode);
}
然后:
function AddTextToContainer () {
var textNode = document.createTextNode ("My text");
var container = document.getElementById ("container");
if (textNode.addEventListener) {
textNode.addEventListener ('DOMNodeInserted', OnNodeInserted, false);
}
container.appendChild (textNode);
}
两者都OnNodeInserted
在 Chrome 中调用。它是一个错误吗?