I just learned why IE7 sucks
BTW, I made my mind and put an order on new egg for the CPU and motherboard for my new HTPC: AMD Athlon 64 X2 5000+ and GIGA GA-M57SLI-S4 NF570 SLI. The $172 combo price(including tax and shipping) is much better than my expectation(newegg rocks!). I’ve OCed to 3.22G and everything works perfect so far. I put all my hard drives on, even I had to buy some storage cases to make some of them fit into 5 inch bay because the case isn’t designed to fit in Seven 3′5 inch hard drives. It might sound really crazy to have 7 hard drives but if you know that’s all the hard drives I’ve been using ever since 1999 you won’t be surprised. Bottom line, I’m a hard drive freak. (I need to learn to let them go, some of them are actually dragging down the system over all performace). I had a little battle when I tried to activate my M$ Vista Ultimate after I reinstall it, the indian jerk showed me some attitude when I asked him to hold on for me to try the code he told me. And as a result after the activation went through, right before I hang up I showed him some of the words I learned from Zed Shaw’s blog and hopefully by the chance he will learned those useful words as well.
All in all I’m very happy with the new box, it runs great now. Once I finished the damn application I’m gonna put a lot stuff on it. The old desktop will be dedicated as a linux lab/war box where I put my hacks on. Ubuntu is my first choice for that box as of now. But….gotta find a hard drive for it. Yeah, I need HARD DRIVES, why are you looking at me like that?
So anyway….where were we? oh yeah, IE 7 sucks, it really does, and yes I’m talking about Internet Explorer 7 by Microsoft. Little did I know how buggy it is until I actually got the chance to look at it from a developer perspective. The experince I had today one day was so impressive that I decided to blog it even that it is 2AM in the morning and it is one of the few days when I actually feel sleepy before 3AM.
So I was working on a crappy simple application using JSON today, the idea was to make a json call from onchange of one combo box A and use the return to dynamicly change the option in another combo box B. So I shamelessly copied and modified smartly utilized some javascript code online to make the json call, put some php code together to pass the object back and wrote another piece of javascript to grab the select combo box, get the innerHTML and injected the new options. It work frawlessly on my beautiful Firefox 2.0. And just before I thought I can wrap things up and actually arrive home before 8PM, I decided to run a quick mini-sanity check on IE7. Just I thought everything is over while sadly it was just the beginnin of a nightmare(hasn’t it always been?): IE doesn’t react at all, like at all. After I change combo box A, combo box B in IE is silent like a piece of shit.
So here comes my first reason why IE7 sucks (or IE sucks in general): IE doesn’t have firebug. It is a firefox plug which is used for front end debugging, well, I used it for debugging my code. It has a lot of nice features like DOM element inspecting, javascript debugging where you can set up break point, watch virables and etc. I used it so much that I don’t know what I do without firebug. So under IE7 I have to actually print out everything I want to figure out what went wrong. I suffered as someone who have been using eclipse and all of sudden he has to use printf + javac to debug. Luckily that process didn’t go very far: I found that every time I try to inject code like “<option>AAA</option>” into the innerHTML via my AJAX call, for the first option it always become something like “>AAA</option>”, no matter how you define it. I did some research online and I found the solution in this blog . The freaking bug is from IE7 itself, oh wait, there is more, do you know this bug has been sitting there for a fucking 5 years from IE5(in a different format, quote needed) and nobody in Microsoft has the guts(or the knowledge, appreantly) to fix it? This is so freaking awosome. Make it suck point two for IE7. I’ve done some additional homeworks for this issue but so far seems there are two ways to solve this and neither of them is perfect, one is to use appendChild() but it will crash IE5(I’m almost speechless at this point) and not very , while the other way is to use outerHTML, and it’s not that time efficient. I finally went with the appendChild() and asked user to use IE6+. Why? because it is relatively slightly easier to code (I’m a lazy guy) and the project is an internal application, there won’t be too much diversified users, plus most of them are QA engineers at Yahoo, they have all kinds of browsers installed on their compters.
So during the debug process I found another issue with IE7: it will cache previous results from its requests therefore combo box B was not being updated, even when I force it to refresh the page by holding shift. WTF? And of course I soon found my answer on another blog post: change GET to POST. Why? I’m guessing maybe they are trying to make people hate very word that actually start with G, oh you know what I mean.
So I went ahead change my GET to POST. Oh wait, I got reaction from IE7! Not in combo box B though, it is still like a dead meat. This time I got some script running error saying: “Expected identifier, string or number”. I suddently got the feeling like I was in my first year of learning computer programm when I felt very excited instead of frustrated because my code causes some kind of error output. I was totally like : “Thank god at least it print out something I can read!”. Based on the fact that my JSON string works on FF but not IE and the issues listed above about IE7, I didn’t spend too much time on this one, and guess where I found my answer? Yeah, another blog post. Those people are just geneous, sometimes I wonder how long does it take for the first person who figure these out, cause you know IE is not open sourced, you can’t just download the source code, take a look, run a white box case and actully found where the problem is and then tell them it is shit. M$ only leaves the space for outsiders to do the last step.
So I modified my php code which generate the JSON return, basically just eliminated the last extra comma, and finally it worked on IE7. Watching the clock turned 9PM, I have nothing to say but thankful for all those awosome bloggers: you guys saved my night…
PS, it took me a week to finish this post, because I tried not to let it stand in the way of my application to CMU. Therefore the timing in the post might be a little bit confusing. Sorry about that.
Special thanks to Andy who told me he’s been reading my blog, really appreciate it, Andy. I’m glad my little space has visitor now:) Little request, next time when you read my blog, if you use web browser, see those boring interesting links on your right? try click them to see what will happen! Haha, just kidding. Thanks for reading and I hope you enjoy these posts as much as I do.