function observeChildNodes(where, fn) {
var config = {
childList: true,
subtree: true
};
var insert = {
type: "insert",
nodes: []
};
var remove = {
type: "remove",
nodes: []
};
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if(mutation.addedNodes.length){
insert.nodes = insert.nodes.concat(mutation.addedNodes);
}
if(mutation.removedNodes.length){
remove.nodes = remove.nodes.concat(mutation.removedNodes);
}
});
if(remove.nodes.length)
fn(remove);
if(insert.nodes.length)
fn(insert);
});
observer.observe(where, config);
}