From 2847d582a3caf82be0a10a3971857a593f2dd381 Mon Sep 17 00:00:00 2001 From: arshabh-copods <77658085+arshabh-copods@users.noreply.github.com> Date: Fri, 26 Feb 2021 19:12:19 +0530 Subject: [PATCH] Update observer.md Fixed some grammatical errors --- docs/observer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/observer.md b/docs/observer.md index 6e5f8e2e83..20417b42c6 100644 --- a/docs/observer.md +++ b/docs/observer.md @@ -53,7 +53,7 @@ In the first case, two mutation records will be generated, namely adding node n1 Due to the second case, when processing new nodes we must traverse all its descendants to ensure that all new nodes are recorded, however this strategy will cause n2 to be (incorrectly) recorded during the first record. Then, when processing the second record, adding a the node for a second time will result in a DOM structure that is inconsistent with the original page during replay. -Therefore, when dealing with multiple mutation records in a callback, we need to "lazily" process the newly-added nodes, that is, first collect all raw, unprocessed nodes when we go through each mutation record, and then after we've been through all the mutation records we determine the the order nodes were added to the DOM. When new these nodes are added we perform deduplication to ensure that each node is only recorded once and we check no nodes were missed. +Therefore, when dealing with multiple mutation records in a callback, we need to "lazily" process the newly-added nodes, that is, first collect all raw, unprocessed nodes when we go through each mutation record, and then after we've been through all the mutation records we determine the order in which the nodes were added to the DOM. When these new nodes are added, we perform deduplication to ensure that each node is only recorded once and we check no nodes were missed. We already introduced in the [serialization design document](./serialization.md) that we need to maintain a mapping of `id -> Node`, so when new nodes appear, we need to serialize the new nodes and add them to the map. But since we want to perform deduplication, and thus only serialize after all the mutation records have been processed, some problems may arise, as demonstrated in the following example: