Hi.. Please take a look at the attached patch, which fixes a
number of
problems with syncing between the renderer and the DOM
(including one bug
that made deleting selection in wordpress impossible, and
the losing-value on
re-display bug), and along the way adds the innerText
support Stefan Eilers
asked for.
The main idea of the changes is a follows:
1. Simplify the syncing logic by making the renderer always
be definitive when
it exists.
2. Change how we initialize from the defaultValue ---
instead of doing it in
the renderer's close (which is what causes the disappearing
text bug), we
update value to defaultValue when the children change. That
also makes
innerText work sensibly on textareas.
Now, a good question is, do other browsers behave like that,
e.g.
change .value when children change? Well, I tested Mozilla,
Opera, IE6, and
looked at the code of Safari. All of them do something
totally different. IE6
and Mozilla's behavior at all pretty weird. Opera's makes
sense, but basic IE
compatibility is a weird hack in innerText. I actually
adopted what Safari
does, because it's simple and as far as I can see should be
compatible with
IE in the less obscure of the cases...
Comments?
-Maks
|