[whatwg] Automatic transaction should support changing the value of input/textarea
Jonas Sicking
jonas at sicking.cc
Sun Nov 27 22:13:08 PST 2011
On Sat, Nov 26, 2011 at 6:57 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
> On my second thought, it's probably okay to require UAs to always restore
> the entire value because the only cause where UA needs to store the old data
> is when the script sets the value in automatic transaction, and it doesn't
> impose new burdens on UAs in any other situations since scripts can't access
> the shadow DOM of native input/textarea implementations.
>
> Alright, I think I'd just say that assignment to value should be revertible
> unconditionally so as long as input and textarea exist.
Another option is to say that if the textarea value is any other value
than the "after" value when a automatic transaction is undone, it
doesn't do anything. One fairly simple way to do this would be to
store a hash of the "after" value and compare that to a hash of the
current value. If the two doesn't match up then undoing the
transaction would do nothing.
This allows the implementation to store far less data for each
transaction. If computing the hash is a concern, then the
implementation could simply store the whole value which is no worse
than what the above requires.
There are other solutions too, which require monitor *all* mutations
that happen to a text node outside of automatic transactions, but they
are likely too complex to implement.
/ Jonas
More information about the whatwg
mailing list