Problems with Javascript observing dom:loaded and IE7

We recently came across a nasty IE7 problem where the browser sometimes doesn’t fire the page-finished-loading event properly, which led to a misleading failure in our Selenium continuous-integration tests. Just thought I’d let you all know….

(Thanks to Ben Gidley for describing the problem and the workaround.)