Re: before/after editaction

On Wed, Sep 7, 2011 at 5:47 AM, Olli Pettay <> wrote:
> What happens if beforeeditaction tears down the document, or
> changes the document significantly or closes the window etc.
> (Those a generic problems with before* events)

It shouldn't make any difference.  The behavior of all the edit
actions is well-defined for any document state.  This kind of thing is
only a problem for something like a mutation event, where the exact
action to be performed is predetermined and might no longer make sense
after DOM changes.  But if you're just doing
document.execCommand("foreColor", false, "red"), then it doesn't
matter what any code does that runs before it.  If it destroys the
document or gets rid of the selection or whatnot, execCommand() will
behave as it normally does in such a situation, probably either doing
nothing or throwing an exception.

Received on Wednesday, 7 September 2011 14:17:41 UTC