RE: form submit events
"Ryan Hicks" <[email protected]> Thu, 16 Mar 2006 10:00:19 -0800
| Newsgroups | gmane.comp.web.dom.wdf |
|---|---|
| Message-ID | <[email protected]> |
>>>>>>
Do I have to account for the event handlers beeing run in *arbitary
order*? I have not tested this very much, but the events seem to fire in
the same order they have been attached to the object. But that's maybe luck?
<<<<<<
From what I've seen, they're called in the _inverse order_ from which they
are assigned. I recall messing with this a while back and deciding to avoid
adding the multiple methods to the same node and propagation type (e.g., an
img can have onload and onmouseover, but not two onloads). I may have come
to that conclusion from reading the W3C, but I'm not certain.
Also, I think you meant to say that the "functions tied to the event
handlers" seem to execute in the same order -- if you're switching gears and
talking about when different events are fired, I have indeed seen
discrepancies between browsers.
I made the quick test below to validate the inverse order thing...this
alerts "banana" and then "apple" in both FF and IE.
-ryan
------------------
<html>
<head>
<script>
function apple () {
alert("apple");
}
function banana () {
alert("banana");
}
if (window.attachEvent) {
window.attachEvent("onload", apple);
window.attachEvent("onload", banana);
} else {
window.addEventListener("load", apple, false);
window.addEventListener("load", banana, false);
}
</script>
</head>
<body>This is a test.</body>
</html>
Unsubscribe
[email protected]
List info
http://www.quirksmode.org/dom/list.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/wdf-dom/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/