What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 130 Stack Exchange communities.

Someone pointed out to me recently that my website doesn't validate. It seems the error is coming from the fact that the JSON returned for StackOverflow flair contains an invalid IMG tag in gravatarHtml:

<img src="..." height="50" width="50" alt="">

The IMG tag isn't self-closing. Should be:

<img src="..." height="50" width="50" alt=""/>
share|improve this question
    
What an interesting dilemma... To XHTML or not XHTML, that is the question. –  David Pearce Sep 15 '09 at 7:54

2 Answers 2

Image tags should not be closed in valid HTML, which Stack Overflow is

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd" >

Closing tags are reserved for XHTML. It's kind of a difficult move from here, since both parties can't be satisfied from the same source.

share|improve this answer
    
Wouldn't the <img /> style also work on Stack Overflow? –  Brad Gilbert Aug 18 '09 at 1:51
3  
So why not offer up only the Gravatar URL? I don't see a reason to send the HTML along at all. –  David Brown Aug 18 '09 at 1:56
1  
Closing image tags in HTML is invalid as well. You can't support XHTML while serving HTML and vise versa. –  Ian Elliott Aug 18 '09 at 1:57
    
If all you want is the gravatar URL then you'll have to parse the response yourself, several pieces of code on META do exactly that. What you suggested isn't a bug though, it's a feature request. –  Ian Elliott Aug 18 '09 at 1:59
1  
At the time of posting, I believed it was a bug. Furthermore, it just seems a little silly that I have to parse the URL from a piece of HTML that's just going to get inserted into HTML/XHTML again anyway. –  David Brown Aug 18 '09 at 2:20
    
I'm not sure I understand your argument anymore –  Ian Elliott Aug 18 '09 at 2:25
3  
What is there to misunderstand? Wouldn't it just be easier to send the Gravatar URL itself in the JSON response rather than an HTML tag? –  David Brown Aug 18 '09 at 2:37
    
Well I think it's clearly easier to send the HTML tag, but more proper to send the URL. It's really up to the developers though, I don't personally have an interest in validation for the sake of validating. –  Ian Elliott Aug 18 '09 at 2:58
    
I'm kind of surprised that not a single wise guy has posted a regex yet ... –  balpha Aug 18 '09 at 6:21
2  
@balpha: That would lead to the obligatory link to Welbog's blog. –  Ladybug Killer Aug 18 '09 at 7:30

We've deprecated the JSON and IFRAME flairs in favor of the simpler .png image flairs:

http://blog.stackoverflow.com/2010/09/flair-now-even-flairier/

Can you switch to that?

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .