If I have a simple <input type="text">
and never mess with its value
property, I can undo (and redo) my actions at will [I mean, keyboard typing and clipboard cut and paste].
But once some event sets its value
the undo stack is gone. I understand that for an arbitrary event it would be very hard (and unnatural, from user perspective) to define how the undo stack should cope with changes introduced by direct attribution to value
.
But I'm thinking about edit events, like <input>
's own input
and paste
events (to give you some context, I'm planning to apply some field masking).
Is it possible to change the object associated with the event (InputEvent
and ClipboardEvent
) instead of manipulating the value
property, so the stack can be preserved? Or otherwise inform "the stack" programmatically how to "undo from here"?