MyBB Community Forums
[Rejected] W3C validation errors for Default 1.8.4 theme - caused by headerinclude script - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Development (https://community.mybb.com/forum-161.html)
+--- Forum: MyBB 1.8 Development (https://community.mybb.com/forum-165.html)
+---- Forum: 1.8 Bugs and Issues (https://community.mybb.com/forum-157.html)
+----- Forum: Rejected (https://community.mybb.com/forum-184.html)
+----- Thread: [Rejected] W3C validation errors for Default 1.8.4 theme - caused by headerinclude script (/thread-169812.html)



W3C validation errors for Default 1.8.4 theme - caused by headerinclude script - Dan_HiHosting - 2015-04-18

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


RE: W3C validation errors for Default 1.8.4 theme - caused by headerinclude script - .m. - 2015-04-18

can you check validation again by selecting HTML5 as the DocType at the W3C validator .. how is the result ..


RE: W3C validation errors for Default 1.8.4 theme - caused by headerinclude script - Eric - 2015-04-18

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.


RE: W3C validation errors for Default 1.8.4 theme - caused by headerinclude script - Euan T - 2015-04-18

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.


RE: W3C validation errors for Default 1.8.4 theme - caused by headerinclude script - Devilshakerz - 2015-04-18

The hack suppressing these errors was removed in 1.8.4: https://github.com/mybb/mybb/commit/ed37daaddf88611eb8185f7964635762eb91cfa4#diff-05b404fc75b0e5bd6d57c79b667b44b8 - for whatever reason it was done, I don't think it's worth restoring only to fit the W3C validation rules.


RE: W3C validation errors for Default 1.8.4 theme - caused by headerinclude script - Dan_HiHosting - 2015-04-18

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.


RE: W3C validation errors for Default 1.8.4 theme - caused by headerinclude script - Devilshakerz - 2015-04-18

(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).


RE: W3C validation errors for Default 1.8.4 theme - caused by headerinclude script - kawaii - 2015-05-10

(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.


RE: W3C validation errors for Default 1.8.4 theme - caused by headerinclude script - Euan T - 2015-05-10

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


RE: W3C validation errors for Default 1.8.4 theme - caused by headerinclude script - Jones H - 2015-06-27

Rejecting because of all of the reasons mentioned above.