prog: (Default)
[personal profile] prog
Righto, I just sacrificed a couple of hours on the altar of trying to get shit to work in MSIE. On the plus side, I think I can eliminate one of the third-party libraries I've been using; MSIE was barking at it, and I find that I can do the same thing it was doing using Prototype, which the application already depends on.

On the minus side, MSIE's XML API eludes me. Consider this code snippet. Given xml_request, an XMLHttpRequest object:
    alert(xml_request.responseText); // This prints the correct thing.
    var xml_doc = xml_request.responseXML;
    var root_element = xml_doc.documentElement;
    if (root_element) {
        alert("I have a document element. I am a sane browser!");
    }
    else {
        alert("I have no document element. I must be MSIE. Fuck.");
    }


The initial alert() makes me sure that MSIE (as well as any other browser) is in fact reading the XML. I just can't do a damn thing with it after that; every attempt to peek into any DOMmish properties of xml_doc returns null.

xml_doc.firstChild and equivalent statements all fail equally (while succeeding on sane browsers). Wha?



Another good reason to drop the library I am dropping? It contains lines of code like this:

MWJ_ldD[MWJ_ldD.length-1].onreadystatechange = new Function( 'if( MWJ_ldD['+(MWJ_ldD.length-1)+'].readyState == 4 ) { '+oFunct+'(MWJ_ldD['+(MWJ_ldD.length-1)+'].load?MWJ_ldD['+(MWJ_ldD.length-1)+']:MWJ_ldD['+(MWJ_ldD.length-1)+'].responseXML); }' );

Holy hannah. That's no way to make friends.

Date: 2007-06-02 04:05 pm (UTC)
From: [identity profile] misuba.livejournal.com
Seriously, for libs like Prototype that get up to 200K when you add script.aculo.us to the picture, some of those techniques can really count. I've seen 75% reductions.

Date: 2007-06-02 04:23 pm (UTC)
From: [identity profile] prog.livejournal.com
gzip, m'man.

I have yet to come to a place where it's worth sacrificing maintainability for optimization. Or anything else.

I'm not saying there is no such place... but I haven't been there yet, if so.

i have

Date: 2007-06-03 01:03 am (UTC)
From: [identity profile] jtroutman.livejournal.com
high volume pages frequented by dialup users.

But in general, yeah, gzip compression. I did some testing on $JOB's website (upwards of ~40k unique visitors per day at peak), and enabling gzip for HTML cut total bandwidth utilization by 55%.

I do admit to using HTML/CSS stripping tools on outbound opt-in emails. Shaving a few kb does seem to make a difference. This means I have also sent HTML format emails, for which I am deeply shamed.

Re: i have

Date: 2007-06-03 04:07 pm (UTC)
From: [identity profile] prog.livejournal.com
You're actually backing up my point here! I remain highly resistant to the idea that it's ever necessary to make your code as unreadable and unmaintainable as my example for the sake of optimization. There's always a better way (such as gzip).

August 2022

S M T W T F S
 123456
78910111213
14151617181920
21222324252627
28 293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 24th, 2025 12:30 am
Powered by Dreamwidth Studios