If you want them in a particular order you should add the functions to an 
array and loop the array on dom / window load as i am positive that the 
array will output in order starting at zero...

var arr;
arr[0]='someMethod_1';
arr[1]='someMethod_2';

for(var =0;i<arr.length;++i) {
$('MyElement').observe('mousedown',arr[i]);
}

... untested and would probably need to be evaled and tweaked a bit but the 
concept remains the same.


Alex Mcauley
http://www.thevacancymarket.com
----- Original Message ----- 
From: "RobG" <robg...@gmail.com>
To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com>
Sent: Wednesday, September 30, 2009 12:34 AM
Subject: [Proto-Scripty] Re: IE Add Observers in Reverse Order?





On Sep 29, 8:45 am, KammylandSoftware <kammyl...@gmail.com> wrote:
> When ever you add oberservers to the same event such as
>
> Event.oberve("myElement", "mousedown", "someMethod_1()");
> Event.oberve("myElement", "mousedown", "someMethod_2()");
>
> does IE execute them in REVERSE order upon fire?
>
> They get executed by order of chronological assignment in FF.
>
> IE is a bloody-idiot.

IE doesn't implement the W3C Event model and even if it did, it
wouldn't necessarily help. The DOM 2 Events specificaton specifically
says event listeners aren't guaranteed to execute in any particular
order:

 "Although all EventListeners on the EventTarget are
  guaranteed to be triggered by any event which is received
  by that EventTarget, no specification is made as to the
  order in which they will receive the event with regards to the
  other EventListeners on the EventTarget."

<URL: http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow-basic
>

However, the DOM 3 Events spec says order must be preserved. You may
find this thread interesting:

<URL:
http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/e7145c0d89caf0a1/e1eec62b11b29315?q=listener+order+group:comp.lang.javascript#e1eec62b11b29315
>

If you want an event registration system that will ensure listeners
are called in the order they are added, you could use something like
the code suggested here:

<URL; 
http://groups.google.com/group/comp.lang.javascript/msg/a318f930c21433d6
>

Read the rest of the thread, it is interesting. You could also read
this one:

<URL: 
http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/e7145c0d89caf0a1/7dd914a8dfef0241#7dd914a8dfef0241
>

Don't use the code suggested by the OP, read the responses by Richard
Cornford to get valuable insights into how to implement what you are
after.


--
Rob



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to