Changing readyness checking to use events
Implemented new ready checking in JSDom and Phantom