We are using MSHTML as an HTML editor in a desktop application, using code based loosely on the editor code available at www.itwriting.com/htmleditor. Among the capabilities of this editor is the ability to wrap multiple editing operations into a single undo/redo step using the BeginUndoUnit and EndUndoUnit methods of the IMarkupServices interface. When the code is run on a machine that has IE10 or lower installed, these batching operations work perfectly, and any MSHTML editing steps performed between BeginUndoUnit and EndUndoUnit calls get wrapped up into a single undo/redo step. When the same code is run on a machine with IE11 installed, the BeginUndoUnit and EndUndoUnit methods seem to have no effect, and operations are no longer batched.
I noticed that IE11 introduced two new commands that can be executed on the document object, "ms-beginUndoUnit" and "ms-endUndoUnit". There are corresponding IDM commands for these as well (IDM_BEGINUNDOUNIT and IDM_ENDUNDOUNIT). So I modified the code to detect when the host machine has IE11 installed and to use these new commands in place of the IMarkupServices methods.
Unfortunately, these commands don't seem to work all that well, and many editing operations do not appear to be batched up into the undo unit, or are dropped altogether. In particular, operations that modify the document's DOM via the IHTMLDOMNode interface, or modify the inline style applied to an element via the IHTMLStyle interface do not seem to be detected and wrapped into the undo batch that is supposedly being created. Calling undo after one of these editing operations results in unpredictable behavior, where rarely, if ever, is the set of changes batched by the undo unit commands actually undone correctly.
Am I missing something, or is undo/redo basically broken in IE11? The IMarkupServices-based undo batching in IE10 and earlier was rock solid. But IE11 appears to have totally broken that paradigm and has not replaced it with anything serviceable. Is this a known issue that might be addressed in the future? Is there some other workaround that I should use to make changes to elements or the DOM so that those changes get properly batched for undo purposes?