hack in an appendChild listener

This commit is contained in:
wgroeneveld 2020-04-13 17:16:30 +02:00
parent 0cfc1d2cfb
commit a8ddc09cb3
1 changed files with 10 additions and 1 deletions

View File

@ -69,8 +69,17 @@ $(function() {
var hijackAppendChildToExecuteAfter = function(afterFn) {
const _appendChild = Node.prototype.appendChild;
Node.prototype.appendChild = function() {
const _insertBefore = Node.prototype.insertBefore;
Node.prototype.appendChild = function(el) {
_appendChild.apply(this, arguments);
console.log('appending ' + el);
afterFn();
}
Node.prototype.insertBefore = function(el) {
_insertBefore.apply(this, arguments);
console.log('inserting before ' + el);
afterFn();
}
}