Chronic validators, how do you validate errors from social media buttons?
My site is totally validated, except for 13 errors and 2 warnings caused by the code provided to me by Facebook and Twitter for their "Like" and "Follow" buttons. How do you validation die-hards get around this?
I don't think you're going to like the answer. You don't have control over social plugins at all. So you can't edit their code to successfully validate it.
To be honest, I'd take the validation results with a grain of salt. So long as you don't commit any major crimes, all those CSS errors and "divs don't belong here" don't really hurt anything.
You could cheat by adding the social media code from JavaScript so that it gets added after you do your validation - provided you are using HTML and not XHTML.
That doesn't make their garbage into HTML but it does at least get rid of the errors relating to their garbage from the HTML that you are validating (which is effectively that part of your page that isn't their code).
Google provide a valid variant for their +1 links, with Facebook their like link is valid HTML and just needs a / added if you are using XHTML. The Twitter tweet button has two invalid attributes but the rest is valid.
With XHTML the invalid garbage would stop the page displaying so you would have to rewrite their code to be valid in order to use it.