Pathgather / please-wait

A simple library to show your users a beautiful splash page while your application loads.
http://pathgather.github.io/please-wait/
MIT License
1.59k stars 158 forks source link

Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'. #4

Closed NickMihaiu91 closed 9 years ago

NickMihaiu91 commented 9 years ago

Keep getting this error:

please-wait.min.js:12 Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'.

I'll switch to the unminified version to pin point exactly where the error happens.

Thank you!

jhdavids8 commented 9 years ago

Hmm, looks like line 212 in the Coffeescript source is the only place we use removeChild. The browser is claiming the parameter we're passing, which is the loading screen, is not a node, but that should certainly not be the case.

I'm assuming this occurred when you tried to close the loading screen, right? Were you playing with any of the internals of PleaseWait, like is there any way you redefined the _loadingElem private variable?

samwalshnz commented 9 years ago

I had this error, but then realised that I was calling the finish method twice, so it was trying to remove a node that didnt exist anymore.

jhdavids8 commented 9 years ago

@NickMihaiu91 did you get it to work? Did @samwalshnz note help at all? If so, I'll close this!

NickMihaiu91 commented 9 years ago

Yes, I was doing the same thing as Sam, calling the finish method twice. Is there a built-in way to check if finish has been already called prior to calling it?

jhdavids8 commented 9 years ago

@NickMihaiu91 there isn't a built-in way. There's a few 'creative' (i.e. hacky) things you can do (like see if the body has the class 'pg-loaded').

Can you describe the case you have where you don't know if the screen has finished or not? I'd consider a PR to allow this, but I want to better understand the use cases for this.