On 7/22/11 11:44 AM, Aryeh Gregor wrote:
Pretty much any formatting command is going to involve adding and removing wrapper elements. To add a wrapper element, say adding a<b> around some text to make it bold, you first have to insert the wrapper before or after the thing you want to wrap, then move all the nodes to wrap into the wrapper.
Actually, you can pretty easily do it in the other order (move the text into the <b>, and then put the <b> in the DOM), and may want to so as to minimize the number of changes the the live DOM; that's something that's often recommended as a performance enhancement.
Likewise, to remove a wrapper, you have to first move all its contents adjacent to it, then actually remove it from its parent.
Again, these can easily happen in the opposite order....
So I don't have any numbers, but anecdotally, editing things definitely does a lot of moving. If you want numbers, though, you probably don't want to look at my implementation -- you want some real-world software that actually uses mutation events.
I don't need software that uses mutation events. I need software that triggers editing operations, so I can them actually measure what DOM mutations are performed in the course of these editing operations.
-Boris