## Monday, February 10, 2014

### Ahh, JavaScript, how I loathe thee.

Okay, to be fair, this complaint isn't really about JavaScript so much as the JavaScript/DOM interface. Specifically, the ordering of event handlers.

Whenever one finds oneself struggling with interacting event handlers, the order of which is not consistent across browsers, one ends up doing something horrid like this:

    myEventHandler = function (evt) {
setTimeout(function () {
... my intended side-effect ...
},
100 // Magic delay in milliseconds,
// which we pray will force the
// right order of events.
};


Bleh. A thousand times, bleh. Please write in if you have a good solution to this problem.

#### 1 comment:

Ilya said...

Can you give an example of when such a situation comes up? Not sure I've had this happen...