Возможно ли внутри event handler'а (DOMNodeInserted или MutationObserver) определить в каком из вложенных в документ файлов был создан новый элемент?
т.е.
<script type="text/javascript">
document.addEventListener("DOMNodeInserted", function (ev) {
var fileName = <some magic here>
console.log("Code from file " + fileName + " created new element");
});
</script>
<script type="text/javascript" src="one.js"></script>
<script type="text/javascript" src="two.js"></script>
Желаемый output:
Code from file one.js created new element
Code from file two.js created new element
Code from file one.js created new element
...
...