as-ideas / oil

191 stars 56 forks source link

document.body.insertBefore is called before the body is available #253

Closed terhoutd closed 3 years ago

terhoutd commented 5 years ago

I have placed all the oil code quite high in the head of my page. as a result I get this error 8 times out of 10. image Inspecting the code it comes from document.body.insertBefore(t, document.body.firstElementChild),

which is called by the renderoil function.

If I move the oil main js file to the bottom of the head then the errors don't happen anymore. It appears the code expects the body to be available while there is 0 guarantee it will be.

subsend commented 5 years ago

Hi terhoutd,

thank you for reporting this issue. We will fix this issue in the next release. For the workaround you have to place oil.1.3.0-RELEASE.min.js after the BODY - tag.