On Thu, May 30, 2013 at 10:17 AM, Sunil Agrawal <
su...@armor5.com> wrote:
> Thanks Rafael for the response.
>
> 1. My use case is similar to the tree mirror/sync mechanism and currently we
> are using the 'raw' MutationObserver APIs, but MutationSummary seems like a
> cleaner high level abstraction for our needs.
>
> What I saw in Firefox is if the web application uses innerHTML, then the
> mutation records contain a bunch of removed nodes (all the nodes that are
> getting removed) and then bunch of added nodes (all the new nodes that got
> added). And syncing these individual operations causes a jerky behavior on
> the receiving end. However, if we can use some heuristics to detect that web
> app used innertHTML then we can potentially improve the user experience.
>
> The current heuristic we use if if the new node that got added has
> previousSibling and nextSibling null, then we try to sync it's parent node,
> and drop the individual removedNodes and addedNodes.
>
> Hence my interest in getting the nextSibling.
>
> I apologize in advance if I am not articulate with my use case.
I think you'll find that your heuristic is incomplete. I suggest just
using (or adapting)
https://code.google.com/p/mutation-summary/source/browse/mutation_summary.js
For your purposes, as it is doing exactly what you need to do:
completely synchronizing a tree from one location to another.
>
> 2. For attributenamespace, web applications like Google Maps and Yahoo Maps
> (for some browsers atleast) use inline SVG, which is in a different
> namespace (SVG namespace). Hence will appreciate if that information can be
> propagated too.
The only thing that MutationSummary can provide for you in this regard
is the *old*-namespace URI of an element. However, it seems extremely
unlikely that, for these uses, the attributes on the non-html elements
will ever change their namespace. Hence, all you should need to do is
examine the *present* namespace of the affected attribute.