[with solution and fix proposal] sporadic error "document.body is null" and continuous page reloads
|Reported by:||beat||Owned by:|
The effect of this error can be disastrous to web servers, as it can reload the page continuously, and fix seems simple at first glance: don't trust the domready event from browser, but check that document.body is not null before accepting that event as valid:
Sporadically I had in firefox 3.5.4 the error "document.body is null"
This was exactly reported in IE too here: http://groups.google.com/group/jquery-en/browse_thread/thread/70e8a050f60f8b08
(that thread being closed, i am opening a new one here)
Interestingly turning cache off with webdeveloper plugin, the error came systematically, and *worse*, did systematically reload the page automatically, cycling the like F5 button pressed permanently, putting load on server. But that also allowed to use firebug to debug.
away. So this worked fine (no page reloads):
- But with just having this it was already permanently reloading the
page with cache off and also throwing error "document.body is null" :
As this is a recommendation for jQuery 1.3, well, you could classify this as a ... template-designer-error, but still:
So that should be fixed in jQuery imho, not just trusting the dom ready event, which seems to be fired too to early on CSS file loads, but to check that there is really a document.body there before trusting the event and starting touching the body even before it exists.
Best Regards, Beat
Change History (4)
comment:1 Changed 6 years ago by john
- Component changed from core to event
- Resolution set to fixed
- Status changed from new to closed
comment:3 Changed 6 years ago by john
- Resolution fixed deleted
- Status changed from closed to reopened