XML DOM hacking in MSIE: halp!
Jun. 1st, 2007 11:25 pmRighto, 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
The initial
Another good reason to drop the library I am dropping? It contains lines of code like this:
Holy hannah. That's no way to make friends.
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.
Argh... I want to play with SVG right now, coz it's going to factor into Chapter 8, but none of Adobe's servers are responding... and a Google search tantalizingly reveals that a Mac OS X-compatible version of Adobe's SVG Viewer plugin exists! Argh argh argh!!!
I spent this afternoon turning my bedroom into someplace I don't mind living and working. Built the wireframe bureau I bought last week, put away all the clothespiles, emptied, flattened, and closeted all the boxes, shelved the books, vacuumed the rug, hung up the pictures, and kludged the curtains (until I can get some real curtain rings). All it really needs now is a whiteboard and a comfy chair. I suppose I could swipe the computer desk's chair, actually, since that is technically mine, but then you have the aesthetic incongruency of a nice chair up against a card table. Well, that aside, I feel very very at peace, sitting here. 's nice.
Why doesn't LiveJournal timestamp entries based on when it receives them? The only input I should give it is the timezone I currently reside in; it should figure out the local time based on that, not by trusting my local machine's clock.
I spent this afternoon turning my bedroom into someplace I don't mind living and working. Built the wireframe bureau I bought last week, put away all the clothespiles, emptied, flattened, and closeted all the boxes, shelved the books, vacuumed the rug, hung up the pictures, and kludged the curtains (until I can get some real curtain rings). All it really needs now is a whiteboard and a comfy chair. I suppose I could swipe the computer desk's chair, actually, since that is technically mine, but then you have the aesthetic incongruency of a nice chair up against a card table. Well, that aside, I feel very very at peace, sitting here. 's nice.
Why doesn't LiveJournal timestamp entries based on when it receives them? The only input I should give it is the timezone I currently reside in; it should figure out the local time based on that, not by trusting my local machine's clock.
Bad day, good day, Pi for supper
Dec. 8th, 2001 10:00 pmYesterday was a bad day. I became very sad, and shut down early. Two true facts about me: it's hard to emotionally unbalance me, but if I do lose balance, a good night's sleep always restores it. This is likely a good thing.
Why was I sad? I was thinking about what a wash A.D. 2001 seems to me. I don't feel as if I've done much this year, especially compared to 1999 and 2000. I thought about various decisions I had made poorly, or failed to make at all, and opportunities lost due to lack of strong communication. And this isn't even getting into the bigger stuff of the layoffs and 9-11. I wanted to cry, and wondered at what age I lost the ability to will myself into doing so, or if I ever really could.
Today was a good day. Worked for a couple hours in the 1369 on chapter 7, which is due tomorrow, enough to convince myself that I can turn it in before Monday's done. I should have had it done today, but I ended up sinking half the day into a visit to Joe's. In retrospect, I think of the scenes from the film "Pi" of Max visiting his mentor. Just like this, Joe is a cranky old man (two years older than me) who works in my field, except far more experienced and published, and who gives me lots of curmudgeonly advice, but who also abandoned his most ambitious project when it got too dangerous (actually he dropped his most recent book contract because it got too boring) and enjoys having me over to play our favorite game, Go. Er, I mean Fluxx. And Settlers of Catan Card Game.
However, even though I am, right according to script, working obsessively with my own project, I failed to ride around randomly on the T while staring at a Settlers black knight token in my hand, and then have dreams about finding my brain sitting on the stairs at the Central Square station. Which is good, because eventually I'd find Joe dead in his apartment, slumped over his keyboard while half-written treatise on Man Things Was Not Meant To Know About XML-RPC glowed on his monitor, and his whole Fluxx deck laid out along pseudo-Kabbalistic patterns (his copy of "The End Is Near" would be open next to it, for reference). So that's good.
If I make a movie about XML it will be called this: <:-/>
Stayed home from Rick's housewarming so I could play with the new*new*new XML::SAX Perl module. Since I'm not very experienced with SAX, and since further it doesn't actually come with the documentation packages it's supposed to (grumble... but forgiveable, since it's only at v0.03), it took some extra time to grok, but I think I got it. Emailed Erik and Nat, asking them to sanity check my summary of the module's magic. (Basically, it seems to be just a highly intelligent parser dispatcher, and its handlers work the same as PerlSAX always has.)
Worth noting: on my walk to the cafe, a very little boy was so ecstatic over seeing the snowfall, finally normal weather, that, ignoring his parents' directions to stay put, he raced down his front steps, picked up a double-mittenful of snow, ran up with a huge grin to a total stranger, and got him good, right on the leg.
"Ouch, I've been snowballed!" I said, only slowing my pace a little, to let him scoot past and dive into a whole yardful of new snow. "Oh! Did he get you?" said his mother. I could only shrug and laugh.
Why was I sad? I was thinking about what a wash A.D. 2001 seems to me. I don't feel as if I've done much this year, especially compared to 1999 and 2000. I thought about various decisions I had made poorly, or failed to make at all, and opportunities lost due to lack of strong communication. And this isn't even getting into the bigger stuff of the layoffs and 9-11. I wanted to cry, and wondered at what age I lost the ability to will myself into doing so, or if I ever really could.
Today was a good day. Worked for a couple hours in the 1369 on chapter 7, which is due tomorrow, enough to convince myself that I can turn it in before Monday's done. I should have had it done today, but I ended up sinking half the day into a visit to Joe's. In retrospect, I think of the scenes from the film "Pi" of Max visiting his mentor. Just like this, Joe is a cranky old man (two years older than me) who works in my field, except far more experienced and published, and who gives me lots of curmudgeonly advice, but who also abandoned his most ambitious project when it got too dangerous (actually he dropped his most recent book contract because it got too boring) and enjoys having me over to play our favorite game, Go. Er, I mean Fluxx. And Settlers of Catan Card Game.
However, even though I am, right according to script, working obsessively with my own project, I failed to ride around randomly on the T while staring at a Settlers black knight token in my hand, and then have dreams about finding my brain sitting on the stairs at the Central Square station. Which is good, because eventually I'd find Joe dead in his apartment, slumped over his keyboard while half-written treatise on Man Things Was Not Meant To Know About XML-RPC glowed on his monitor, and his whole Fluxx deck laid out along pseudo-Kabbalistic patterns (his copy of "The End Is Near" would be open next to it, for reference). So that's good.
If I make a movie about XML it will be called this: <:-/>
Stayed home from Rick's housewarming so I could play with the new*new*new XML::SAX Perl module. Since I'm not very experienced with SAX, and since further it doesn't actually come with the documentation packages it's supposed to (grumble... but forgiveable, since it's only at v0.03), it took some extra time to grok, but I think I got it. Emailed Erik and Nat, asking them to sanity check my summary of the module's magic. (Basically, it seems to be just a highly intelligent parser dispatcher, and its handlers work the same as PerlSAX always has.)
Worth noting: on my walk to the cafe, a very little boy was so ecstatic over seeing the snowfall, finally normal weather, that, ignoring his parents' directions to stay put, he raced down his front steps, picked up a double-mittenful of snow, ran up with a huge grin to a total stranger, and got him good, right on the leg.
"Ouch, I've been snowballed!" I said, only slowing my pace a little, to let him scoot past and dive into a whole yardful of new snow. "Oh! Did he get you?" said his mother. I could only shrug and laugh.