I'm trying to listen for changes in a XML structure using Javascript. I've got the following code:
var doc = document.implementation.createDocument("", "root", null);
doc.addEventListener("DOMNodeInserted", function(event) {
alert("changed!");
}, false);
doc.documentElement.appendChild(doc.createElement("test"));
This is not working. However the following code does work:
document.addEventListener("DOMNodeInserted", function(event) {
alert("changed!");
}, false);
document.body.appendChild(doc.createElement("button"));
What am I missing here?