On 11/07/2008 12:03 AM, Travis Leithead wrote:
I recently found an email thread from waaaay back where some internal folks at
Microsoft had come to the IE team asking about our support for Mutation Events.
They had a concern with the current DOM L3 Spec's DOMCharacterDataModified
event because of its lack of specificity. I just found this email and thought
I'd summarize some of the issues in hopes of starting a productive discussion
about how to address them (or not).
This team was building some kind of networked editing synchronization tool
(sorta like MS OneNote-which you should try if you haven't already-very cool)
and they needed their webapp to respond to changes in a text node
(CharacterData) while the user is typing to synchronize the changes over the
network. Specially, regarding the DOMCharacterDataModified event, they wanted
to know:
* How frequently is it supposed to fire? (For example during editing (i.e.,
contenteditable) does it fire per-character change [super verbose] or only
after a some cumulative number of changes?
* Is there an easier way to know exactly "what" changed? The event as spec'd
right now (in DOM L2 and L3 events) provides the prevValue and newValue properties which
can be used to analyze the difference. It seems like DOM L3 could provide additional help
by additionally including a range (DOM L2 Range) object with the exact changed text in it.
I haven't investigated other browser implementations yet, I just wanted to
throw this out there for comments.
Opera doesn't seem to dispatch DOMCharacterDataModified when modifying contentEditable, webkit and gecko dispatch for
each key press (and that is what I think the behavior should be).
-Olli
-Travis