Please create a hook in the JS code for VisualEditor that would allow modifying the HTML of the page prior to the save actually happening. Or if such a hook already exists, please point us to it and close this task.
Context: we have this awesome Gadget on fawiki which identifies dictation errors and highlights them in the text. Highlighting is done by wrapping the words or phrases in <span> tags with style attributes for the color. The problem is, when this gadget is enabled and so is the VisualEditor, upon page save, the span tag is also consumed by visual editor and the page output will permanently contain the highlights (see this diff as an example). We would like to change the code such that when a page save is requested from VisualEditor, our gadget would get a callback (via the requested hook) and cleanup all these <span> tags.