Ticket #2709 (closed bug: fixed)
globalEval works incorrectly in IE6 if the current page has <base href> tag in the HEAD
|Reported by:||eych||Owned by:|
That's a weird problem, but I've experienced it on a production site and was able to reproduce it in a simple test (attached to this ticket).
The problematic scenario is this:
- You have a page (let's call it A) with <base href=" http://domain/path/" /> in the HEAD. And jQuery loaded as well.
- On the same page you have a button which if clicked will make an Ajax call to another page (let's call it B) and will insert the response in a div inside page A.
- This page B has usual HTML content (a bunch of divs) and a JS script block, which has code that should be executed when the Ajax response is added to page A after the Ajax response finishes.
In all browsers this works fine, except IE6. In IE6 I always get "Invalid argument" error which points to
head.removeChild( script );
line in globalEval method of jQuery (line 655).
I did a lot of testing an eventually nailed down the problem to the <base href> line in the head of the page. If it's there, I get an error in IE6, if it's not then everything's fine.
Somewhat accidentally I was able to come up with a solution which fixes this weird behavior of IE6:
In globalEval method on line 654 I simply replaced
head.appendChild( script );
head.insertBefore( script, head.firstChild );
and the problem vanished. Please look at the attached test case (the paths should be corrected in it in jquery.globalEval.html file and this file should be opened in the browser).
Hopefully this could be officially fixed in the next jQuery version.
- Status changed from closed to reopened
- Resolution fixed deleted
- Status changed from reopened to closed
- Resolution set to fixed
- Milestone changed from 1.2.4 to 1.2.5