Compliance is hard

30 December 2008

So I had occasion recently, courtesy of the Microsoft giveaway of a pre-beta installation of Windows 7 at PDC, to actually try out Internet Explorer 8.

Lest you start piping up and saying "you can install it on Vista too you know", and pointing me to the URL, let me acknowledge that you are right, and Mehul has been prodding me to do so. But I feel a browser is a very personal choice and you will be wrestling Firefox out of my cold dead hands. Especially with all the plug-ins I have loaded in it now it feels like my browser and no one else's. I do my FTP through it, my Amazon S3 access, I explore the CSS from various websites with a nifty plug-in called FireBug, etc.

Incidentally, the only thing I don't like about Firefox is that it doesn't work well when you're debugging a web app. Visual Studio doesn't notice that you've closed the window or tab in Firefox, and you have to manually go and click Stop Debugging. Am I missing some option or plug-in?

Anyway, where was I? Oh yes, IE8. During the planning for this release there was this whole discussion about how IE8 should deal with, er, badly formed HTML and CSS. Or, rather, pages that included deliberate hacks to get around bugs in previous versions of IE, most recently and notably IE6. Should the new browser produce the same bugs, so all those millions of pages aren't broken in IE8? Should it announce itself in another way to fool all those JavaScript hacks? Etc.

Well, if you've used it, you'll know you can mark certain websites to be accessed in "compatibility mode" (there's a little icon next to the address bar). In essence you go to your usual website and if it looks "funny", you click the icon and the browser pretends to be IE7 and redisplays the page.

To which I usually go: it's not that hard to write a compliant page, come on. All this work the IE team has had to put in to get around the hacks that were put in the pages to get around the bugs in a previous version of IE. Brrr.

And then yesterday for whatever reason I ran the home page on my personal website through the W3C validator. 650 errors. Now believe me, I've spent time on this sucker. Many evenings sweating over a keyboard, typing <div></div>, manipulating pixel widths and tweaking color values in TopStyle to get the best effect. I know that my damn HTML and CSS are squeaky clean.

Ah, but, the problem with modern dynamic websites is that what gets on the page isn't necessarily just my HTML. I use a CMS called Graffiti (a younger, smaller sibling to Community Server, which we use here on the Community site), and it generates through the use of plug-ins, widgets — compiled code, essentially — HTML on my pages. Other people wrote those plug-ins and in certain cases hard coded invalid HTML or URL fragments in the assemblies that make their way onto a page.

I also write posts with Windows Live Writer (as I do for this blog). I'd been using WLW in its default mode, which is to produce HTML. My web page template is XHTML (transitional). So, through my acceptance of the default options, WLW had been posting mal-formed XHTML to my website (things like <br>, <img> elements without the final "/>", and so on).

And the browsers we use don't make developing websites any easier either. (Why don't Firefox, IE7, Safari, and Chrome have a "strict compliance" switch that will fail the loading of a page with an error? I had two <p>'s in a row with no </p>, do you think any of the browsers threw a visible error?). I have noticed that Firefox' log is a hot bed of interesting information about CSS and JS errors (visit gmail with it showing to have a merry laugh), and that has helped a bit.

So all in all, 650 errors. And the realization that, even with someone who "knows" what he's doing and is aware of the issues, compliance is sheer hard work.

2 comment(s)
Brandon Turner [MSFT]

For you problem with Windows Live Writer you might want to try doing Blogs > Edit Blog Settings > Advanced  >Markup Type > XHTML

30 December, 2008
Julian Bucknall (DevExpress)

Brandon: Yep, once I found that setting, I switched it over, and then republished all my blog posts (well, at least the last 10 of them, so the home page would validate "better").

Cheers, Julian

31 December, 2008

Please login or register to post comments.