On Wed, Mar 5, 2014 at 8:47 AM, Felipe G <fel...@gmail.com> wrote:

> If I go with the clone route (to work on the snapshot'ed version of the
> data), how can I later associate the cloned nodes to the original nodes
> from the document?  One way that I thought is to set a a userdata on the
> DOM nodes and then use the clone handler callback to associate the cloned
> node with the original one (through weak refs or a WeakMap).  That would
> mean iterating first through all nodes to add the handlers, but that's
> probably fine (I don't need to analyze anything or visit text nodes).
>
> I think serializing and re-parsing everything in the worker is not the
> ideal solution unless we can find a way to also keep accurate associations
> with the original nodes from content. Anything that introduces a possibly
> lossy data aspect will probably hurt translation which is already an
> innacurate science.
>

Maybe you can do the translation incrementally, and just annotate the DOM
with custom attributes (or userdata) to record the progress of the
translation? Plus a reference to the last tranlated node (subtree) to speed
up finding the next node subtree to translate. I assume it would be OK to
translate one CSS block at a time.

Rob
-- 
Jtehsauts  tshaei dS,o n" Wohfy  Mdaon  yhoaus  eanuttehrotraiitny  eovni
le atrhtohu gthot sf oirng iyvoeu rs ihnesa.r"t sS?o  Whhei csha iids  teoa
stiheer :p atroa lsyazye,d  'mYaonu,r  "sGients  uapr,e  tfaokreg iyvoeunr,
'm aotr  atnod  sgaoy ,h o'mGee.t"  uTph eann dt hwea lmka'n?  gBoutt  uIp
waanndt  wyeonut  thoo mken.o w
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to