adobe/brackets — pull request #4733 by njx (2013-08-10 00:10:32+00:00)
Title: Make sure DOM and marks are up to date when the browser re-requests...

...instrumented HTML on reload or document save.

For #4730. There were two issues:

* Originally, the instrumented HTML only needed to be parsed when the file changed on disk. Now we need to ensure that when a complete rethink is requested (which happens on browser reload or file save), the DOM is regenerated even if the file is just dirty in memory.
* `generateInstrumentedHTML()` didn't used to be responsible for updating the marks in the editor, so the marks would be stale if its call to `scanDocument()` recreated the DOM. Now we make it refresh the marks as well.

Note that this basically assumes that we want to do a full reparse of the DOM when the user saves the file or reloads in the browser. I think that's a good thing, because it gives the user an easy way to recover if they get into a bad state during incremental edits. If we didn't want to do that (and rely on the incrementally updated DOM when the browser reloads, for example), we could rejigger some of the logic here, but I like the idea of those two events forcing a "clean slate".