Throttle any function. Has one example using DOMSubtreeModified. http://stackoverflow.com/questions/11867331/how-to-identify-that-last-domsubtreemodified-is-fired
function throttle( fn, time ) {
var t = 0;
return function() {
var args = arguments,
ctx = this;
clearTimeout(t);
t = setTimeout( function() {
fn.apply( ctx, args );
}, time );
};
}
document.addEventListener("DOMSubtreeModified", throttle( function() {
//code
}, 50 ), false );