watchmydom

A Javascript library to watch DOM changes

Add elements/attributes to see the changes in console,

var domResults = {};

/* watchMyDom call*/
domResults = new watchMyDom('.dom-results')

/* Watching */
domResults.watch(function(result, info){
    result.output.forEach(function(e){
        if(e.addedNodes != undefined){
            $('.results-1').append('<div> Added a '  + $(e.addedNodes)[0].nodeName + '</div>')
        }
        else if(e.removedNodes != undefined){
            $('.results-1').append('<div> Removed a ' + e.removedNodes.nodeName + '</div>')
        }
        else{
            $('.results-1').append('<div> Updated attribute ' + e.addedAttributes.nodeName + '</div>')
        }
    })
})