Side navigation
#1314 closed bug (worksforme)
Opened June 21, 2007 08:08PM UTC
Closed December 12, 2007 07:19PM UTC
jQuery fails when document in IFrame is changed.
Reported by: | Royce | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.2 |
Component: | event | Version: | 1.2.1 |
Keywords: | IFrame | Cc: | |
Blocked by: | Blocking: |
Description
jQuery fails when running in an IE7 IFrame and the document is changed, ex: navigating to a pdf file.
Fails on line 1322 in the "fix:" method,
var e = document.documentElement, b = document.body;
At this point the document is "undefined" and fails.
Example:
/////////////////////////////////
<html xmlns="http:www.w3.org/1999/xhtml" >
<head>
<title></title>
</head>
<body>
<iframe name="IFrame" src="jQuery.aspx"></iframe>
</body>
</html>
///////////////////////////////////
jQuery.aspx
////////////////////////////////
<html xmlns="http:www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<script src="jquery.js"></script>
</head>
<body>
<form id="form1" runat="server">
<a href="http://illiad.evms.edu/sample.pdf">Test</a>
</form>
</body>
</html>
I have traced it back to the onunload being attatched to the window.
The problem seems to be the way IE bubbles up events.
The event is comming from the window so at this point the document = undefined.
If you attatch the events to the document object the code will run, so the event will bubble from the document and then up to the window before IE destroys the document object.