Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#6991 closed bug (invalid)

No such interface supported error on .load() for pop-up window in IE 8

Reported by: kevinkevin Owned by: kevinkevin
Priority: low Milestone:
Component: event Version: 1.4.2
Keywords: needsreview Cc:
Blocked by: Blocking:

Description

When I create a new window and try to set its load event with .load(), I get a "No such interface supported error" in IE 8.

Test case:

<!DOCTYPE html PUBLIC "-W3CDTD HTML 4.01EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <title>test</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> function openWindow() {

var newWindow = window.open('test.html', 'newWindow'); $(newWindow).load(function() {

alert('loaded'); alerts 'loaded'; this.document.getElementById('someText').value='loaded'; sets text of 'someText' in new window window.document.getElementById('someText').value='it loaded'; sets text of 'someText' in original window

});

} </script> </head> <body> <p><button type="button" onclick="openWindow();">Open Window</button></p> <p><input type="text" name="someText" id="someText" value="" /></p> </body> </html>

A Solution: remove the following lines from jQuery.event.add:

For whatever reason, IE has trouble passing the window object around, causing it to be cloned in the process if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) {

elem = window;

}

It then works in IE 8. I haven't tested previous versions, I'm wondering if you have a test for IE versions before 8, only have the if above in that case.

My test page never does an alert or anything in Firefox, and get no errors, so I have no idea how to fix that.

Change History (4)

comment:1 Changed 9 years ago by dmethvin

Component: unfiledevent
Keywords: window open load added

I wasn't even sure if this was something that could reasonably be done, but the "more interesting example" at the W3C site seems to indicate it is possible: http://www.w3.org/TR/REC-html40/interact/scripts.html#h-18.2.3

It seems like there's a race condition that could prevent it from working reliably. If the opened window loads before the load handler is attached, you won't get any notification. I agree that the code you've identified, which looks for a window object, is at least part of the problem since it is replacing your window with the current document's window.

If you could attach a complete test case showing this work in bare DOM operations, similar to the example at the W3C site, that might help get this bug fixed sooner.

comment:2 Changed 9 years ago by snover

Keywords: needsreview added; window open load removed
Milestone: 1.4.3
Priority: low

comment:3 Changed 9 years ago by dmethvin

Owner: set to kevinkevin
Status: newpending

Can you provide a test case that shows it works properly without jQuery?

comment:4 Changed 9 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.