Facebook proudly declares itself to be XHTML 1.0 Strict via the doctype embedded on every page. However, as anyone who has had a peek at the source code will be able to confirm, this is not even wishful thinking but a downright lie. Forget the usual “I’m trying to be valid but a few mistakes are bound to creep in” problem (which is as far as I often get); these guys are defining custom attributes, repeating ID tags and not escaping ampersands in URLs.
I was digging into the “Invite friends to an event” page because I wanted to see how the “Invite Friends on Facebook” search was so responsive (I tried something similar a few months back and gave up). Turns out it’s extremely simple, but makes huge use of custom attributes on tags. Validating the page gave me over 300 errors.
Two points:
- Why should anyone care?? Facebook have created something amazingly popular with sort-of a web 2.0 interface and it works in all major browsers. Who can complain about that? Well, I’m going to. Leaving aside issues of ‘That’s not fair!!’ because they’ve taken a pragmatic approach that got the job done fast and which I wouldn’t be happy using, the point of standards is to be a standard. If Facebook don’t have any intention of being valid XHTML 1.0 why claim to be so? What happens in the future if browsers tighten up? Is Facebook only looking to the short-term, until someone purchases it and its founders’ profit?
- Could everything Facebook have done be done without custom attributes, or are they a necessary evil? Looking at it I’d say it can all be done without, but some of the Javascript code would be more complicated and tied to the HTML structure (having to get certain data from child elements).
Incidentally Facebook could have the best of both worlds: extend the XHTML doctype to allow these attributes and have valid code at in the process!
1 comment so far ↓
I was investigating the same stuff when I came across your blog post…
I want to validate my own website (that uses some of Facebook’s iFrames) and I get at least 35 errors and all of them from those iFrames, both declaring my site as transitional or strict…
Keep it up
.-
Leave a Comment