Hi Jake,
Unfortunately the DOM structure is bound more to the JavaScript way of doing things than Widgets. In
JavaScript you can't have more than one event listener (of a given event type) per element, while
Widgets may have any number.
So to work around this: GWT Widgets are the only listeners on their nested Element object (notice
they implement the com.google.gwt.user.client.EventListener interface). SO when they receive an
event from the browser, they decode it into a DOMEvent and dispatch it to all the Handlers
registered for that Widget.
Unfortunately there is no simple way to deal with this on the DOM nodes themselves, and in
particular there is no simple way to deal with IFrame loading events. If you take a look at how
FormPanel receives loading events from it's hidden IFrame there are two different implementations
(one for IE6, and the generic implementation).
For normal browsers(com.google.gwt.user.client.ui.impl.FormPanelImplIE6), the event is hooked using:
iframe.onload = function() {
IE6 (com.google.gwt.user.client.ui.impl.FormPanelImplIE6) looks like:
iframe.onreadystatechange = function() {
if (iframe.readyState == 'complete') {
Both implementations also ensure that they "unhook" the events, by assigning the listener function
to null (see FormPanel.onAttach / onDetach). I would consider extending the Frame Widget rather than
using the DOM api directly. Widgets provide loads of useful safety nets that you otherwise need to
write yourself (including attaching multiple Handlers to the element).
Hope this Helps.
//J