Opened 12 years ago
Closed 9 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: |
Description
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 http://bytes.com/topic/javascript/answers/510057-iframe-ie-onload-problem, and [18122].
Test case attached.
Attachments (1)
Change History (5)
Changed 12 years ago by
Attachment: | onload.html added |
---|
comment:1 Changed 12 years ago by
(In [19105]) Menu on iframe related fixes (refs #9606 !strict):
- Fix from Doug so that scrolling main document doesn't mess up menu position
- 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 11 years ago by
Milestone: | tbd → future |
---|
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 9 years ago by
Owner: | changed from sjmiles to Kris Zyp |
---|---|
Status: | new → assigned |
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 9 years ago by
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
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.
put in dijit/tests to run, when fixed "dojo.connect onload" message should appear in console when pressing the buttons