Tweet Button Not Valid XHTML

1,055 views
Skip to first unread message

BG

unread,
Nov 19, 2010, 1:17:52 AM11/19/10
to Twitter Development Talk
Hello,

I hope this is the right place to post this but I have found an issue
when using the Tweet button on my website. I use the custom version.

When I run it through the W3C Validator I get these errors and I have
tried Doctype variations but they all don't validate.

there is no attribute "data-url"

there is no attribute "data-count"

there is no attribute "data-text"

there is no attribute "data-via"

I make my websites to validate for a number of reasons and they are
usually 100% valid but with the tweet button they won't validate
anymore. I'm surprised at this as I thought the developers would have
made sure the button validates before anything!

Tom van der Woerdt

unread,
Nov 19, 2010, 9:59:48 AM11/19/10
to twitter-deve...@googlegroups.com
These attributes are HTML5 attributes, not XHTML attributes.

Tom

Rbeuque74

unread,
Nov 28, 2010, 8:38:21 AM11/28/10
to Twitter Development Talk
It could be great to have a 100% valid XHTML1.0Strict tweet button,
because I want all my website pass w3c check, and now it's broken ...

Matt Harris

unread,
Nov 29, 2010, 5:00:37 PM11/29/10
to twitter-deve...@googlegroups.com
The data-* attributes were introduced in HTML5, and will cause the W3C Validators to error if your webpage doctype isn't HTML5. For the Tweet Button to be XHTML compatible you have to use the Query String format instead of the data attributes. 

For example instead of:
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<a href="http://twitter.com/share" data-url="http://dev.twitter.com" data-via="twitterapi">Tweet</a>

Use:
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<div>
</div>


Best,
@themattharris
Developer Advocate, Twitter
http://twitter.com/themattharris


--
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: http://groups.google.com/group/twitter-development-talk

Reply all
Reply to author
Forward
0 new messages