(function(){ function logMutation(m) { if(m.type == 'attributes') { attributeMutation(m); } else if(m.type == 'childList') { childListMutation(m); } else if(m.type == 'subtree') { attributeMutation(m); } else { console.debug(m); } } function attributeMutation(m) { // target's attributes are to be observed. if(m.attributeName == 'class') { var msgs = []; msgs.push( 'Class, ' + createElementId(m.target) ); if(m.oldValue !== m.target.className) { var exisitingClasses = (m.oldValue ? m.oldValue.split(' ') : []); var currentClasses = m.target.className.split(' '); var addedClasses = []; var removedClasses = []; for(var x=0; x