MyBB Community Forums

Full Version: W3C validation errors for Default 1.8.4 theme - caused by headerinclude script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

Apologies if this has already been talked about (surprised if it hasn't), but I couldn't find anything when searching.

Currently the default template doesn't seem to pass W3C validation, because of two lines in the script in the headerinclude template:

line 30: 	var loading_text = '{$lang->ajax_loading}';
line 40: 	var spinner = "<img src='" + spinner_image +"' alt='' />";

W3C Validation errors:
line 30: document type does not allow element "br" here
line 40: document type does not allow element "img" here


Basically the script includes br and img body elements, in the head.

Can this be addressed, perhaps by placing the script elsewhere?

I'm surprised you'd let the default theme not pass W3C validation.

Thanks
can you check validation again by selecting HTML5 as the DocType at the W3C validator .. how is the result ..
W3C validation is a set of guidelines, it doesn't need to be followed in it's entirety. This is just my opinion of course, but I believe people read into validation far too much.
Also, this seems like a bug in the validator. The tags it is referencing are inside JavaScript variables, and thus have no effect on the actual document until they're rendered by the JS.
The hack suppressing these errors was removed in 1.8.4: https://github.com/mybb/mybb/commit/ed37...9b667b44b8 - for whatever reason it was done, I don't think it's worth restoring only to fit the W3C validation rules.
I tried HTML5 but that throws far more errors with the Default theme because of obsolete HTML usage such as table width, align etc. attributes (I personally get 97 errors because I also close my meta with /> for xhtml1 compliance).

@Eric J. and @Devilshakerz the thing is, I understand (perhaps incorrectly) that valid code is used by Google as a metric. Perhaps they don't use W3C validation - but their own - and perhaps they wouldn't pick these up as errors - but unless anybody knows better we'd just be speculating, and not having valid markeup could damage a site's rankings.

I really don't think the Default theme/template should produce invalid markeup.

I'm also not sure why the javascript uses both ' and ". You can even see that in the two offending lines. Surely one or the other should be used for consistency? It would look more professional certainly.
(2015-04-18, 07:42 PM)Dan_HiHosting Wrote: [ -> ]@Eric J. and @Devilshakerz the thing is, I understand (perhaps incorrectly) that valid code is used by Google as a metric. Perhaps they don't use W3C validation - but their own - and perhaps they wouldn't pick these up as errors - but unless anybody knows better we'd just be speculating, and not having valid markeup could damage a site's rankings.
I wouldn't say you should worry about the HTML markup up to this level; much more important factors starting to influence the search result pages today are mobile friendliness (crucial when searching from mobile devices) and encrypted connection (HTTPS).

Quote:I'm also not sure why the javascript uses both ' and ". You can even see that in the two offending lines. Surely one or the other should be used for consistency? It would look more professional certainly.
I agree; keep in mind though that part of the development team is working on MyBB 2.0 and things like code inconsistencies in 1.8.x are generally considered the lowest priority (especially given that there are still many bugs and issues to be resolved).
(2015-04-18, 05:52 PM)Eric J. Wrote: [ -> ]W3C validation is a set of guidelines, it doesn't need to be followed in it's entirety. This is just my opinion of course, but I believe people read into validation far too much.

From what I understand Google search algorithm prioritizes sites with clean, valid code according to W3's standards. Therefore this is likely to have a minor impact on SEO.
There are much bigger factor to affect SEO though. Many of Google's sites also do not pass correctly, as the W3C validator is extremely strict (e.g.: the Google Plus site gets 969 errors and 35 warnings when I just checked it). There are much bigger things you can change to improve SEO Smile
Rejecting because of all of the reasons mentioned above.