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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to