let target = document.getElementById(Post.ViewModel.postURLId);
let observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
console.log(mutation);
});
});
let config = {
attributes: true, childList: true, characterData: true, subtree: true,
attributeOldValue: true, characterDataOldValue: true
};
observer.observe(target, config);
// later, you can stop observing
observer.disconnect();
if (target.addEventListener) {
target.addEventListener('input', function(e) {
console.log(e);
}, false);
}
So with the help of above two tricks and browser breakpoints and stacktrace we can detect exact source of error.
References
https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver