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

The W3C validator reports errors when the Stack Overflow homepage is run through it.

Simple fixes, like wrapping CDATA sections inside scripts, get around a lot of errors.

Does the team use any tools like YSlow? It looks as though JavaScript and CSS aren't minified, script references are not at the bottoms of pages, etc.

share|improve this question
1  
Possible duplicate: meta.stackexchange.com/questions/23178/… –  heavyd Apr 6 '10 at 15:21

2 Answers 2

up vote 5 down vote accepted

Why isn’t the main SO site fully W3C standards compliant?

Because it works for all intent and purposes even if it's not. That's all that matters, right?

Simple fixes like wrapping CDATA sections inside the script gets round a lot of errors.

CDATA is XHTML. Stack Overflow uses HTML.

Do the authors use any tools like ySlow? It looks as though javascript and css isn't minified, script references are not at the bottom etc.

They are. Scripts at the bottom won't really speed up the loading of the page in a noticeable fashion; many popular websites including wikipedia have them at the top.

share|improve this answer
1  
Thanks - that told me! :) –  Lygpt Apr 6 '10 at 15:30
    
The very few errors on the Stack overflow page could indeed be fixed by wrapping the JavaScript code into CDATA tags. htmlhelp.com/tools/validator/problems.html#script and I too would be interested to know whether there's a special reason behind that. –  Pëkka Apr 6 '10 at 16:18
    
@Pekka: SO uses HTML, not XHTML. –  BalusC Apr 6 '10 at 16:28
    
@BalusC is using CDATA limited to XML? Correct me if I'm wrong, but that would be new to me. I have been using it merrily in HTML for years, and as far as I know, it is both best practice and valid standard to wrap script content into CDATA tags to prevent the validator from validating actual JavaScript string data (which is happening here). –  Pëkka Apr 6 '10 at 16:44
1  
@Pekka: I knew the same (that CDATA is XHTML-only). With HTML you have to escape the closing brace: <\/test>. –  Andreas Bonini Apr 6 '10 at 17:08
    
@Pekka: either you actually used XHTML or you didn't revalidate after adding CDATA (it would still error on it!). Escaping the closing brace as Kop commented is indeed the right way in HTML. –  BalusC Apr 6 '10 at 17:30
    
@BalusC @Kop dang, you are right! en.wikipedia.org/wiki/Cdata I stand corrected. –  Pëkka Apr 6 '10 at 19:08
    
You can use //<![CDATA[ in HTML, but it doesn't do anything. The content of <script> and <style> is already CDATA, in which the only invalid character sequence is the </ (ETAGO) token that should according to SGML rules end the element (though in fact that's not what browsers do). –  bobince Apr 6 '10 at 20:03

The only invalid piece comes from the ad server.

share|improve this answer
    
Fair point :) Although not too important, I was referring to the inline script blocks not being minified (that would be a challenge though!). –  Lygpt Apr 7 '10 at 11:06

You must log in to answer this question.

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