Skip to main content

Bug Tracker

Side navigation

#2612 closed bug (invalid)

Opened March 28, 2008 10:46PM UTC

Closed December 02, 2010 08:07AM UTC

Last modified January 31, 2011 05:54PM UTC

domManip is not always respecting script execution order on IE7

Reported by: jwagner Owned by: jwagner
Priority: low Milestone: 1.5
Component: ajax Version: 1.5
Keywords: script ajax getScript domManip Cc:
Blocked by: Blocking:


I have an application where I have several script nodes that I append on a node.

When those script elements have a relative src, jquery-1.2.4 manages to execute them synchronously and in the correct order. From what I understand, this is the expected behavior.

But when the script elements have an absolute src, IE7 does not wait for the synchronous execution of the nodes. This leads to random problems in IE7 when a function that is defined in a remote script is called in another inline script element.

Attached is a proposed patch to execute the scripts on a callback chain, using jQuery.getScript when necessary.

I hope this patch suits your coding standards and that you will also consider that the jquery-1.2.3 behavior on this point is a bug.

I can adapt it if you give me some advice because I would really like to have it incorporated in the next jquery release as it fixes a bug on my application.


Attachments (1)
Change History (7)

Changed March 18, 2009 03:39AM UTC by brandon comment:1

component: ajaxcore

Changed May 15, 2009 11:56PM UTC by barrettas comment:2

This bug is related to using the XMLHttpRequest object to load scripts when the script src is of the same domain as the page. I came across the same problem in jQuery 1.2.6 when trying to make an AJAX widget which loads in pages of different and same domains. When loading on a location that has a different host it worked fine because synchronous loading was honored, but when loading from a location that had the same host it broke due to jQuery thinking all dynamically inserted scripts were loaded before they actually were. I traced the problem to be in the ajax function where the code checks if the script src is for the same domain and if not it loads via inserted script elements, which works while also adhering to the synchronous flag. I'm not sure why it was decided to load scripts differently when on a different domain? Note that I got around the problem by using the following hack:

eval("var location={host: \\"lame_hack\\",protocol:window.location.protocol};;;jQuery.ajax=" + jQuery.ajax.toString());

What I am doing is reevaluating the ajax function and placing a location variable in scope which contains a host field that will never match the current host. This causes all scripts to take the code route where they get loaded via script element insertion and thus synchronous loading is honored.

Changed November 13, 2010 08:03PM UTC by dmethvin comment:3

#3281 is a duplicate of this ticket.

Changed November 15, 2010 12:46AM UTC by SlexAxton comment:4

component: coreajax
owner: → jwagner
priority: majorlow
status: newpending

Can someone verify that this is still an issue?

Changed December 02, 2010 08:07AM UTC by trac-o-bot comment:5

resolution: → invalid
status: pendingclosed

Automatically closed due to 14 days of inactivity.

Changed January 31, 2011 05:53PM UTC by john comment:6


There wasn't a 1.4.5 release, was actually 1.5.

Changed January 31, 2011 05:54PM UTC by john comment:7


There was no 1.4.5 release, was actually 1.5.