<html>
<head>
</head>
<body>
<div id="d">foo</div>
<button onclick="d.style.display='block'">show</button>
<button onclick="d.style.display='none'">hide</button>
<script>
observer=new MutationObserver(function(mutations){
mutations.forEach(function(mutation){console.log(mutation.target)})
})
observer.observe(d, {attributes: true})
</script>
</body>
</html>