Add support for lydell’s fork of elm/virtual-dom #40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes Lamdera work with my fork of elm/virtual-dom. More information coming soon. No need to merge this yet.
Lamdera copies some functions from elm/virtual-dom, to make modifications to them. My fork of elm/virtual-dom also changes those functions. This PR copies those changes, and supports both the original version and my fork by
if
-ing on whether_VirtualDom_wrap
exists (one of the new functions in my fork, arbitrary choice). This is for_VirtualDom_applyPatches
,_VirtualDom_diff
and_VirtualDom_applyPatches
.My fork also removes
_VirtualDom_equalEvents
, which Lamdera references. The solution is to just define the variable.Finally, I added the
data-elm
attribute to<pre id="elm"></pre>
. My fork only virtualizes elements withdata-elm
, for better compatibility with third-party scripts.lamdera live
assumes that initializing the Elm app removes that element, and displays a message in it otherwise:compiler/extra/live.js
Lines 124 to 126 in 6415988
By adding
data-elm
to it, Elm will virtualize it, and then realize that it isn’t needed and remove it (just like before).Note: I have only tested
lamdera live
. I have not tested a production upgrade between two app versions, but I’ve gone through the code and it looks like it should™️ work.