There’s some pretty exciting new features / bug fixes on the horizon for IE 8, so I thought a quick post might be in order. I must confess, this is the first release of IE that I’m fairly excited about! Normally they just induce a deep, dark sense of foreboding… The following list isn’t exhaustive: it just contains the features that are of most immediate practical use to JS developers like myself. Stuff like ARIA, “activities” and other features aren’t discussed. Check out Microsoft’s “IE8 Readiness Toolkit” page for those.
- First off, the old workhorse function document.getElementById now, finally, only returns elements by id. Woo-hoo! In all IE versions to date, it also returns elements by name, if the ID isn’t set. This can be a real pill at times.
- A new Object.querySelector method, providing a cleaner way to locate elements. This is a nice addition based on the W3C specs, but having used jQuery’s amazing xpath-friendly selectors, it seems a bit, like, so yesterday. Example usage:
1div.querySelector("p span"); - getAttribute and setAttribute now behave like they should – and like they do on virtually every other browser. Namely, getting and setting attributes and not returning weird objects and stuff.
- DOM Storage. This is a neat one. I’m no Flash expert, but it seems to be similar to Flash Objects – providing the developer with a way to store information on the person’s computer, rather than using the justifiably reviled “cookies”. (Up to 10MB per domain, apparently!). Microsoft were pretty upfront that this is a simple hash object with getters & setters – it’s not a database.
- A new Firebug-like tool for debugging, etc.
- Ajax Navigation: window.location.hash. From my viewpoint, this is probably the most exciting upcoming feature. In the past, I’ve made several posts about the RSH (Really Simple History) library, now maintained by Brian Dillard. This script provides a browser independent way of maintaining the use of the browser’s Back button within Ajax apps (or tries to, I should say – there are still some open critical bugs). Well, the window.location.hash property lets you log pages in the browsers history – just like with most of the other browser vendors out there – so now when you click back, it’ll load any pages logged in that object. Instant back button friendliness. There was an enticing post on Ajaxian about the possibility that this new feature will render the RSH library obsolete. Brian thinks not, and I fully agree. He also notes a few caveats with the Microsoft model.
Related links:
Microsoft’s “Readiness Toolkit” for IE8, written in a depressingly sales-pitchy kind of way:
http://www.microsoft.com/windows/products/winfamily/ie/ie8/readiness/DevelopersNew.htm#ajax
Some more technical details on the release:
http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=ie8whitepapers&ReleaseId=581
John Resig (jQuery dude) wrote an interesting – and enthusiastic – post about the upcoming changes here:
http://ejohn.org/blog/javascript-in-internet-explorer-8/
Brian Dillard, who took over the Really Simply History (RSH) project from Brad Neuberg last year, comments on the nifty new Ajax-friendly nav: http://blogs.pathf.com/agileajax/2008/03/ie8-html5-and-a.html
W3C CSS3 selectors:
http://www.w3.org/TR/css3-selectors/
Recent Comments