As raised in #1256218: W3 Validation errors on rel=home, out-of-the-box Drupal 7 and Omega 7 give validation errors when tested with the W3 validator, e.g.:

The 3rd party HTML5 validator service html5.validator.nu gives the same:

The question is, what can be done to fix these problems? Is it a problem with the validators being inflexible or are the errors legit?

Comments

ANDiTKO’s picture

The W3 validator link works in "Doctype: -//W3C//DTD HTML+RDFa 1.1//EN". You have to re-validate it in HTML5 Doctype and you will get less errors. Since HTML5 is not finalized nobody knows what will be added, changed or removed. So making it validate wont do that big of a difference. Dont forget that valid sites might still display messed up on internet explorer.

artfulrobot’s picture

Title:W3 Validation errors?» W3 Validation errors

I found disabling RDF module sorted 90% HTML5 validation issues.

Disabling RDF broke views RSS feeds. This patch fixed that.

Validation is really important to me. Without this we could all "go ie6" and the web would quickly become a complete mess. It's always going to be an uphill struggle esp. with constant emergence of new technologies but I believe it's one worth defending.

DamienMcKenna’s picture

@artfulrobot: That sounds intriguing, I'll try it out.

DriesP’s picture

What are the complications I will get from removing a few lines from html.tpl.php?

I changed it from:

<?php print $doctype; ?>
<html lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>"<?php print $rdf->version . $rdf->namespaces; ?>>
<head<?php print $rdf->profile; ?>>
  <?php print $head; ?>
  <title><?php print $head_title; ?></title> 
  <?php print $styles; ?>
  <?php print $scripts; ?>
  <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>

To this:

<!DOCTYPE html>
<head>
<?php print $head; ?>
<title><?php print $head_title; ?></title>
<?php print $styles; ?>
<?php print $scripts; ?>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>

This fixed the validation issues, but I have the feeling I did something dangerous here. :-)

Any thoughts?

DamienMcKenna’s picture

@DriePie: I have a feeling that would possibly cause Metatag's OpenGraph support to break, it needs to add things to the actual html tag.

DriesP’s picture

How about now:

<!DOCTYPE html>
<html lang="<?php print $language->language; ?>">
<head>
<?php print $head; ?>
<title><?php print $head_title; ?></title>
<?php print $styles; ?>
<?php print $scripts; ?>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>

<body<?php print $attributes;?>>
  <div id="skip-link">
    <a href="#main-content" class="element-invisible element-focusable"><?php print t('Skip to main content'); ?></a>
  </div>
  <?php print $page_top; ?>
  <?php print $page; ?>
  <?php print $page_bottom; ?>
</body>
</html>

Now everything validates just fine. Does anyone think this will lead up to complications?

bogorman’s picture

Would be interesting to hear other comments on this issue. DriePie has made an interesting suggestion.
Are there any disadvantages in modifying html.tpl.php as he suggests?

bogorman’s picture

Would be interesting to hear other comments on this issue. DriePie has made an interesting suggestion.
Are there any disadvantages in modifying html.tpl.php as he suggests?

scor’s picture

I believe all these validation issues should be fixed with this patch: #1674238: Adapt html.tpl.php output to RDFa 1.1 / HTML5. Please confirm if it works for you.