.

Garrghh - IE Frustration |

It turns out that I have a problem under IE. It isn’t even one of those tiny problems - it’s a big problem - apparently Event management under IE is seriously different from Event management under Firefox. I thought I had worked everything out, but the brief time spent working with IE under Linux has shown me the truth.

Here is the addEvent function I’ve been using for a long time

/* Thanks to Scott Andrew  && Aaron Boodman*/
function addEvent(obj, evType, fn){
    if (obj.addEventListener) {
        obj.addEventListener(evType, fn, false);
        return true;
    } else if (obj.attachEvent) {
        var r = obj.attachEvent("on"+evType, fn);
        return r;
    } else {
        return false;
    }
}

Maybe you have the same thing in your Javascript stack. Well it turns out this is broken. Today I learned : addEvent Considered Harmful(Two geek points if you get the reference in the title)

Yeah I know that article is a year old - I’m apparently a little behind. It turns out Quirksmode.com held a contest. They even managed to pick a winner

As I started digging further I ended up running into these two posts - saying - Just use the Yahoo Event Handler. Ajaxian and the original from Dustin Diaz

His article goes into a lot of depth - so I won’t repeat the actual mechanics of switching from what I started with to Yahoo. Truth be told I looked at Yahoo UI about 6 months ago. It has a lot of features, and is BSD licensed which makes it simpler to integrate with internal code. The part that was scary was just how much code is in the library. 3MB of javascript - is a freaking lot! I basically stayed away. Now I guess I’m going to start small with the event stuff then I’ll see what else is worth mixing in.

I admit I’m sorely tempted to use it because I know they are testing against a lot more browsers than me which means I better browser support without a lot of effort on my part.

One Response to 'Garrghh - IE Frustration'
  1. Katherine:

    I saw this title pop up in my google reader, and I was kind of hoping you had something to say about IE 7 in particular.

    I upgraded, and I think it is buggy… well, buggier than usual.

    I may have to go elsewhere for my browsing for a while…

Leave a Reply

Moderation Active: Old stuff here... Therefore your comment on this post will be moderated (i.e. don't submit twice !)

    Categories
    Archives

    .