I’ve just run into one of jQuery’s thornier issues.
While creating a map viewer for the S:GTC I found my code worked in FireFox and Chrome perfectly but refused to budge in IE7. Some of you may know that the map in Space currently only works correctly in IE6 – not good when most of the planet uses something other than. I thought with standards being pretty much standard these days and the bits that are not yet standardised being abstracted away by jQuery (and the ilk) I thought it would be plain sailing.
Until I tried to get the value of background-position. Turns out that IE doesn’t support background-position for getters but supports background-position-x (and -y obviously). So you can suppose that concatenating the strings would get us to the point where we want to be. Yes? No.
In my humble program I need values. Pixel values. I don’t want em, %ages and I certainly don’t want it as a string. What use is that to me? Okay I can create a big switch statement for top, bottom, left, and right but what about center? To cope with that I’d have to check ahead to see what it is and then convert accordingly. So much for ‘Write less, do more’.
There is a whole raft of information on the Net about this very issue and I’ve ran into it after a couple of weeks but amazingly no one has offered a viable solution. There’s a handy test to see it in action. View it in your favourite browser and then check it out in IEx. That’s right Microsoft hasn’t fixed IE8.
Personally I am so frustrated with the whole situation that I feel like browser-sniffing for IE and banning them outright – not just inform them that they have a substandard browser. If all devs did that then MS would have no option but to fix it. Sod backwards compatibility – if you rely on a bug to work then expect the fix to ‘break’ your mark up. Eventually standards really would be standard, people would learn to write compliant code and dirty hacks be a thing of the past.