views:

41

answers:

1

Once again the IE Monster has hit me with an odd problem.

I'm writing some changes into an asp.net site I inherited a while back. One of the problems is that in some pages there are several controls that add javascript functions as handlers to the onload event (using YUI if that matters). Some of those event handlers assume certain other functions have been executed.

This is well and good in Firefox and IE7 as the handlers seem to execute in order of registration. IE8 on the other hand does this backwards.

I could go with some kind of double-checking approach but given the controls are present in several pages I feel that'd create even more dependencies. So I've started cooking up my own queue class that I push the functions to and can control their execution order. Then I'll register an onload handler that instructs the queue to execute in my preferred order.

I'm part way through that and have started wondering 2 things:

  1. Am I going OTT?
  2. Am I reinventing the wheel?

Anyone have any insights? Any clean solutions that allow me to easily enforce execution order?

+2  A: 

http://www.quirksmode.org/js/events_order.html

dusoft
helpful but given my use of YUI I seem to be a little insulated from the vagaries of bubble v capture.
LRE
Could be, I just wanted to point out that this is so low-lying and influenced by each browser that you will probably be unable to control it.
dusoft