Fix W3C Validation Errors #34

Submitted by ddeitterick, but the push didn't work on IE8/9. I hope I've
extracted the required parts and implemented them correctly here.