Opened 13 years ago

Closed 10 years ago

#9609 closed defect (wontfix)

dojo.connect(iframe, "onload", ...) ineffective on IE

Reported by: bill Owned by: Kris Zyp
Priority: high Milestone: future
Component: Events Version: 1.3.2
Keywords: Cc:
Blocked By: Blocking:


On IE,

dojo.connect(iframe, "onload", ...)

has no effect. The specified handler isn't called when the iframe's src attribute is changed.

The problem is that the event code ends up doing

iframe.onload = dispatcherFunc;

which doesn't work for IE.

Simply calling the browser built in functions attachEvent/attachEventListener does work though.

Actually I'm not sure why we don't just call those methods all the time (when attaching to events on DOM nodes). It seems much more straightforward than maintaining our own dispatcher function and _listeners array.

See also, and [18122].

Test case attached.

Attachments (1)

onload.html (1.5 KB) - added by bill 13 years ago.
put in dijit/tests to run, when fixed "dojo.connect onload" message should appear in console when pressing the buttons

Download all attachments as: .zip

Change History (5)

Changed 13 years ago by bill

Attachment: onload.html added

put in dijit/tests to run, when fixed "dojo.connect onload" message should appear in console when pressing the buttons

comment:1 Changed 13 years ago by bill

(In [19105]) Menu on iframe related fixes (refs #9606 !strict):

  1. Fix from Doug so that scrolling main document doesn't mess up menu position
  2. Rebind any time the iframe contents are reloaded (ie, any time the iframe src is changed). This is needed since a connection to an iframe is actually connecting the <body> node inside the iframe. (note: had to work-around broken dojo.connect(iframe, "onload), refs #9609).

comment:2 Changed 13 years ago by James Burke

Milestone: tbdfuture

This seems to be a longstanding issue, not a specific regression, so going to put it for the future. Seems like the way to address it is to reevaluate how our event connection stuff works.

comment:3 Changed 10 years ago by bill

Owner: changed from sjmiles to Kris Zyp
Status: newassigned

I know now that we don't use attachEvent() on IE because it doesn't allow canceling events, or something like that. So perhaps this is wontfix?

comment:4 Changed 10 years ago by Kris Zyp

Resolution: wontfix
Status: assignedclosed

I believe that attachEvent also adds event listeners in the wrong order (last added event listener is executed first), so we have to maintain our own array of listeners even if we do use attachEvent, to maintain consistency.

Note: See TracTickets for help on using tickets.