Skip to main content

Bug Tracker

Side navigation

#12018 closed bug (fixed)

Opened July 05, 2012 12:17PM UTC

Closed July 06, 2012 02:16PM UTC

Last modified August 28, 2012 03:31PM UTC

$(document).ready() fires too early in IE8

Reported by: Owned by: mikesherov
Priority: blocker Milestone: 1.8
Component: core Version: 1.8b1
Keywords: Cc: mikesherov
Blocked by: Blocking:


1. Open the URL in a modern browser like Chrome with the console open. Observe that the linked JavaScript file loads first and prints a message to the console. Then the document ready event fires and logs a message. At this time, $('#container').length is 1.

2. Open the same URL in IE8. Now the document.ready event fires before the script is loaded, and the container div is not recognized.

3. In IE8, run the same page with jQuery 1.7.2. Everything works as expected.

Attachments (0)
Change History (12)

Changed July 05, 2012 01:32PM UTC by dmethvin comment:1

cc: → mikesherov
component: unfiledcore
milestone: None1.8
priority: undecidedblocker
status: newopen

It works in IE8 when run outside the jsFiddle iframe:

In 1.8 we were trying to fire ready when readyState==="interactive" and it doesn't look like we can if jQuery itself is in an iframe:

Thanks for the report!

Changed July 05, 2012 01:43PM UTC by anonymous comment:2

You're welcome! We had a similar problem in Highcharts with the readyState in IE8. We worked around it by checking if window == (triple equals don't work in this case).

Changed July 05, 2012 02:49PM UTC by mikesherov comment:3

owner: → mikesherov
status: openassigned

Wow, look at that. I'll see there's a workaround. If not, I'll most likely revert. :-\\

Changed July 05, 2012 03:18PM UTC by mikesherov comment:4

All is not lost: it seems as if this is only a problem when a script is included before the rest of the content. Also, the doScroll hack still works, I just need to add it to the interactive check for oldIE. Fix coming shortly. Thanks again for catching this bug.

Changed July 06, 2012 02:16PM UTC by Mike Sherov comment:5

resolution: → fixed
status: assignedclosed

Fix #12018, readyState "interactive" in oldIE lies! Closes gh-848.

Changeset: f5fd41252e3ae48a655c5da4a0b2910bb897b6ed

Changed August 22, 2012 04:34PM UTC by AndyWNY comment:6

This is still happening for us in 1.8.

I do not have a good test case for you right now unfortuantely as I am not 100% yet why it happens only on certain pages... but definitely only happening in 1.8.

Changed August 22, 2012 04:37PM UTC by AnyWNY comment:7

Sorry that was in IE 9.

Changed August 22, 2012 04:51PM UTC by dmethvin comment:8

@AndyWNY, yes it will happen in 1.8.0 since we never go back to change code in a release we've already made and keep the same version number. That would be really confusing! The problem should be fixed in 1.8.1 which should be out in a few days. You can check your code against our work-in-progress version, .

Changed August 22, 2012 07:19PM UTC by comment:9

This is not working in IE 9 - I go to the above link ( and it returns:


Then --- running highcharts.src.js from GitHub

It seems that in my code if I put the <script> tag that contains the "ready" function at the BOTTOM of my html page, it works.

It worked fine with jQuery 1.7.1 no matter where the <script> tags were. There are only two small images (that have always been there) and to me, the ready is called when the DOM is ready. Seems like 1.8.0 this is not 100% the case. If only in IE.

Changed August 22, 2012 07:23PM UTC by dmethvin comment:10

@kevingrigsby, you're using the 1.8b1, not even 1.8.0 and certainly not the jquery-git.js that has been fixed. Please, please, please just look one post above.

Changed August 23, 2012 05:07AM UTC by anonymous comment:11

I have the same issue! please release 1.8.1

Changed August 28, 2012 03:31PM UTC by anonymous comment:12

@dmethvin @mikesherov

jQuery 1.8 - I have the same problem, IE9 $(document).ready() fires too early.

works fine on jQuery 1.7.2

Please release 1.8.1