While recently checking Twitter I noticed a sidebar about the Tweet Button. In curiosity I followed the link and started exploring what they created. After some tinkering with the settings, I had a code sample that looked a bit like this:
I dropped it in my website and, like any responsible web-developer, revalidated my page. Much to my dismay, their code was invalid!
It's plain to see why: they've added their own "expando" parameters (
data-via) to the anchor/link tag. While browsers generally play nice with made-up tag parameters, and HTML5 makes
By simply adding an
Extra line-breaks added to both code samples for clarity; could be removed. Also, if you set any of the other parameters, such as language, be sure to add a call to
setAttribute() for those.