On Tuesday, October 11, 2016 at 9:09:31 PM UTC+1, OvermindDL1 wrote:
>
> Remember, it is just a diffing algorithm, when it gets to that point of 
> your vdom and it compares an old vdom node of, for example:
> ```
>   checkbox [ onClick (CheckToggle 42) ] [ text "Something" ]
> ```
> and compares it to the new of:
> ```
>   checkbox [ onClick (CheckToggle 43) ] [ text "Another thing" ]
> ```
> It sees that there are two changes (well potentially 1 due to lack of 
> keyed event handlers, but we'll say 2 for this example), thus it accesses 
> the checkbox at the index that it is at here (say, 14 or so) by just 
> something like `var node = curNode.children[14];` then just applies the 
> two changes `node.removeEventHandler("click", oldEvent); 
> node.addEventHandler("click", newEvent); node.children[0].nodeValue = 
> "Another thing";`, which was just removing the old event handler, adding 
> the new, and mutating the text.
>
 
Interesting to see this expained, thanks.

By making it keyed then it is like "oh, these do not match at all, probably 
> a major structural change, kill the old, create the new".
>

I have to admit I am not really sure how Html.Keyed works, so this is an 
illuminating discussion for me. Could you answer some basic questions about 
it for me?

If the 'key' of a keyed node is the same, is it never updated?
If 'key' of a keyed node changes, is the whole node built anew?

Or something else, please explain it to me, thanks.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to