Friday, August 29, 2014

coping skills: monitoring DOM changes

Debugging other people's code is tough, especially when there's heavy use of frameworks.

In this case some other code was changing the contents of a DataTable cell, and I didn't know how to track down what code was making the change.

Turns out Chrome and Firefox have pretty good facilities for adding breakpoints based on DOM changes! In Chrome's Elements tab, right click on an element, and there is a convenient "Break on..." menu, with a few convenient options for the type of change you're worried about.

I've worked with so many primitive environments that I'm sometimes a bit more adept with log-based / println style debugging, but my debugger mojo has grown reasonably strong as of late. (The nice thing about log-based debugging is it really forces you to think about the assumptions you're making, and you're less likely to get swamped by a flood of information.)

More Information at Stackoverflow (as usual).

No comments:

Post a Comment