Brad Fitzpatrick (brad) wrote,
Brad Fitzpatrick
brad

JavaScript

I've been doing a lot of JavaScript the past couple days, trying to expand my horizons.

Holy crap, man.

I'm pretty smart, but this shit is hard. Between IE, Moz/Firefox, and Safari/Konq, I've seen everything. I'm now educated in quirks mode, strict mode, the different box models, the different event registration models, the different DOMs, the different ......

Very little's the same between browsers.

After getting stuff working 95% of the way in Moz and IE (props to x2vnc), Safari mostly worked, except for the part that does real work. Instead I get:

(timer):Null value

That's it. No line numbers. No context. No backtrace. That's the extent of Safari's debug output, even after jumping through hoops to make it even log that.

So I sprinkle alerts in. My event handler, a closure, has a numeric captured variable now replaced by the target of the event. What!? All the other alerts in the code show that the variable was only ever numeric, up to the point where I returned an anonymous function using that variable.

So I installed Konqueror 3.3.2 on my Debian box, to see what it did, just for shits. Sure enough, it's buggy (or obeying different "standards") in the same way that Safari is. But Konqueror goes down more than whitaker's mom (but not as well), so that's not helping.

I still remain optimistic that I'll learn all this, it'll make sense, I'll write some compatibility wrappers, and I'll only target the wrapper. If a browser can't do something, it gets the old HTTP-only behavior, and only a modern browser (or IE 6.0) gets the fun stuff.

Here's hoping my optimism lives.
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 28 comments