// the find
paulirish/break-on-access
break on access to a property
A ~50-line debugging utility that wraps `Object.defineProperty` to trigger a `debugger` statement whenever a property is read or written. Useful for tracking down mystery mutations to things like `document.cookie` or layout-triggering property reads. It's a snippet, not a library — paste it into DevTools and run it.
Conditional breakpoint support via a callback function covers the realistic case where you only care about the Nth mutation or a specific value. The enable/disable API on the returned object is a nice touch for surgical debugging sessions. Paul Irish's authorship means the browser compatibility edge cases around `Object.defineProperty` were actually thought through. At ~50 lines, you can read and understand the entire thing in two minutes.
Last touched in 2019 — no updates in seven years. Chrome DevTools has shipped native 'break on attribute modification' for DOM nodes, which handles the most common use cases without any snippet. The repo has no package.json, no npm publish, and no module format — you're copy-pasting raw code. Tests exist but run in a qunit.html file you open manually in a browser, which is charming in a 2012 kind of way.