My understanding is that the Elm should create the entire DOM every time, 
and the runtime will do the diff and change the parts that need changing.

In other words, unless one has JS to change the UI while Elm is evaluating 
an event (e.g. disabling a button to give the user instant feedback), one 
never uses show-false for a node because Elm will simply create the new DOM 
without the node in it.

Cheers

On Tuesday, February 28, 2017 at 9:11:41 AM UTC-8, Rupert Smith wrote:
>
> I am using a MutationObserver to watch a node in the DOM got changes to 
> its size.
>
> I attach this to a particular DOM node by its id. The model then changes 
> and Elm re-renders the view. Unfortunately the DOM node seems to be deleted 
> then completely replaced by a new one with the same id. I tried Html.Keyed 
> to hint that the same node should be re-used, but no luck with that.
>
> It would be very helpful to get an understanding of the criteria under 
> which a DOM node will be completely overwritten. I did have this working at 
> one point, but refactored a lot of stuff since then, and now it is broken.
>
> The actual code is this:
>
> div
>     [ class "editor-inline__wrapper"
>     , id <| "inline__wrapper" ++ asUUID contentModel
>     ]
>     [ content ]
>
> Where 'content' can be is rendered through a number of different code 
> paths, depending on whether it is currently selected, and whether it is 
> currently edited. It takes its value from this:
>
> content =
>             mapWhenWithSelectedModel
>                 (\selected ->
>                     if (asUUID selected.contentModel == contentId) then
>                         case (Overlay.editedValue selected.overlay) of
>                             Just value ->
>                                 markdownView <| withMarkdown contentModel 
> value
>
>                             Nothing ->
>                                 markdownView contentModel
>                     else
>                         markdownView contentModel
>                 )
>                 mode
>                 |> Maybe.withDefault (markdownView contentModel)
>
> All I need is for the DOM rendering to use the same div to wrap this 
> content, as the content itself changes, so that it can be observed.
>

-- 
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