On Wed, Aug 5, 2009 at 6:50 PM, John-Mark Bell<[email protected]> wrote:
> On Wed, 2009-08-05 at 17:57 +0800, Bo Yang wrote:
>> Hi,
>>    For Events model, there are 7 types of MutationEvent, and they are
>> DOMCharacterDataModified, DOMAttrModified, DOMNodeInserted,
>> DOMNodeRemoval, DOMNodeInsertedIntoDocument,
>> DOMNodeRemovedFromDocument, DOMSubtreeModified.
>>
>>    I have supported the first 4 ones, but for the last three ones, I
>> think it is better to discuss something here.
>>
>> 1. For DOMNodeInsertedIntoDocument/DOMNodeRemovedFromDocument, the
>> spec ask that each Node inserted/removed from the document, we should
>> dispatch such an Event. But this may cause many events generated, do
>> you think they are indispensable for our implementation? Should we
>> support them now?
>
> Yes, they should be supported.

Ok.

>
>> 2. For the  DOMSubtreeModified event, I think the best time it should
>> be generated is after a bunch of JS(or other scripts which manipulate
>> DOM) end. But how do we find that that is an end. I am wondering what
>> is the best way to deal with this event type...
>
> You'd need a record of the lowest common parent node affected by the
> batched events. The simplest way to batch events is to count the number
> of mutation events and send DOMSubtreeModified after a given number have
> been processed. More complex would be to add a timeout, to ensure the
> SubtreeModified event gets flushed if insufficient modifications have
> occurred to cause it to be emitted normally.

Ok, let me figure out how to add a timeout. :)

Regards!
Bo

Reply via email to