-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when reloading page: TypeError: Cannot read property 'firstChild' of null #38
Comments
I've heard about this issue time and again, some manage to fix it in strange ways, some don't.. It happens almost 100% if you try to start Personally I consider it a really bad NW.js bug.. NW.js should always give the right It's like it was meant to be used with just one window, without refreshing.. I've even seen |
I think that the reason this happens is because of the way NW.js works.
I imagine that the issue is in jQuery in this case, as it was first loaded with a different document, and it never refreshes. It might be possible to solve it by removing jQuery from the node.js cache, like I do with You could try to tweak it to remove jQuery too then |
Thanks for the explanations. I suspect the same that jQuery might be holding onto a previous version of the document. I will give it a shot and see what happens. |
Try it with:
Instead of the code i linked above, as it's on |
The combo of above with Thanks! |
@yinso make a PR for it, you found it, tested it, should also push it :) |
Yeah sure - will take care of this ;) |
Using nw.js 0.12.3, and the error happens on reload of the page.
The calling code looks like this:
It occurs at
index.js
line 75 as the query ofgetElementById
returns null, but it happens due to a switch of context at line 72, where the code$(this.context).hasClass("webchimeras")
returnstrue
, and$(this.context).find(".wcp-wrapper")[0].id
returnswebchimeras
, which causesthis.context
to be set to#webchimeras
instead of staying at#player
.For some reason the copy of
<div id="player" />
found by jQuery has been adorned withclass="webchimeras"
and a child element of<div class="wcp-wrapper">
, but those don't exist inwindows.document
's copy of<div id="player" />
when viewed in devtools.1 - where are the above attributes and elements being set? By wcjs-renderer?
2 - could they be set to a different copy of the element, i.e. jQuery isn't referring to the same document as
window.document
upon refreshing the page?The text was updated successfully, but these errors were encountered: