Skip to content

Instantly share code, notes, and snippets.

@nexpr
Created February 23, 2016 13:58
Show Gist options
  • Select an option

  • Save nexpr/fd7d47ff485da2a6fccc to your computer and use it in GitHub Desktop.

Select an option

Save nexpr/fd7d47ff485da2a6fccc to your computer and use it in GitHub Desktop.
デバッグ用 innerHTML 監視
function monitorOverwriteInnerHTML(elem){
var desc = Object.getOwnPropertyDescriptor(Element.prototype, "innerHTML")
Object.defineProperty(elem, "innerHTML", {
get: function(){
return desc.get.call(this)
},
set: function(x){
console.log(this, x)
desc.set.call(this, x)
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment