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 upUse doc.documentElement instead of doc.body #711
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
process-bot
Sep 12, 2016
Thanks for the pull request! Make sure it satisfies this checklist. My human colleagues will appreciate it!
Here is what to expect next, and if anyone wants to comment, keep these things in mind.
process-bot
commented
Sep 12, 2016
|
Thanks for the pull request! Make sure it satisfies this checklist. My human colleagues will appreciate it! Here is what to expect next, and if anyone wants to comment, keep these things in mind. |
devinrhode2
referenced this pull request
Sep 12, 2016
Closed
If doc.body is null, throw "move elm.js <script> " #709
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
May 22, 2018
Member
I think the current behavior makes more sense. I think it is reasonable to run the Elm program after the body exists.
|
I think the current behavior makes more sense. I think it is reasonable to run the Elm program after the body exists. |
devinrhode2 commentedSep 12, 2016
•
edited
Edited 1 time
-
devinrhode2
edited Sep 12, 2016 (most recent)
If elm is initialized in javascript above the
<body>tag,document.bodywill be null, causing the renderer to fail with this error message:Uncaught TypeError: Cannot read property 'appendChild' of null. The Renderer is trying to call appendChild on the rootDomNode, which is null if it's document.body. Here's my commit where I was stuck on thisI think we can simply use
document.documentElementinstead ofdocument.body, assuming there aren't other additional direct references todocument.body. I tested this by directly editing the built elm.js file and it worked well.