Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upElm.embed should accept a div with children. #47
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Dec 14, 2014
Member
Makes sense. Is the intended behavior that instantiating the component destroys all the existing children?
|
Makes sense. Is the intended behavior that instantiating the component destroys all the existing children? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
laszlopandy
Dec 14, 2014
Contributor
Yes, on the first render the component should delete all children.
On Sunday, December 14, 2014, Evan Czaplicki notifications@github.com
wrote:
Makes sense. Is the intended behavior that instantiating the component
destroys all the existing children?—
Reply to this email directly or view it on GitHub
https://github.com/elm-lang/core/issues/47#issuecomment-66899024.
|
Yes, on the first render the component should delete all children. On Sunday, December 14, 2014, Evan Czaplicki notifications@github.com
|
laszlopandy commentedDec 13, 2014
Currently if you try to embed Elm on a div with children it fails with:
Error: Elm.node must be given an empty DIV. No children allowed!However there is a valid use case when this should be allowed. I am porting a mobile web app from React, which needs to start up as quickly as possible. My React version did something like this:
The spinner div has some CSS animation applied to it, and starts animating immediately while the scripts are loading. Once React has booted up, the first render will replace the children (including spinner) with the real app (or with the same spinner div if the app is still waiting for data). This is a very useful way to lower the perceived loading time.