Skip to main content
Known Participant
September 16, 2018
Question

Validation returns DOCTYPE error, and adds it's own html.

  • September 16, 2018
  • 2 replies
  • 788 views

w3c validator (on text input) inserts <html lang=''><!DOCTYPE html> following the <!DOCTYPE html> that already exists in page source.

Also shows a non-existent </style> tag after </html> that is not in page source.

How is it that code appears as error when no such code exists in page source?

Error on Google Analytics expected as site source on a local server.

FF Dev shows no console errors aside from google code.

=====Actual page source======

<!DOCTYPE html>

<html lang-‘en’>

<head>

============Validation Results==================

  1. <!DOCTYPE html><html lang=''><!DOCTYPE html>
  2. <html lang=‘en'>
  3. <head>

====Validation also shows/creates </style> tag after </html>========

</body>

</html>

</style>

========Actual page source code as follows============

</body>

</html>

This topic has been closed for replies.

2 replies

ALsp
Legend
September 16, 2018

It is impossible to give you an accurate answer unless you post a link to your actual page... putting snippets of code in a forum post is rarely effective in permitting a proper analysis. Is your page available to view online?

Known Participant
September 16, 2018

Thanks for your response, Al.

Only posted a snippet in order to focus on my primary question: "How the extra code (which was not on page source) just appears in the validation result.

That really piqued my curiosity, but not enough to spend a lot of time on it. Easier to just rebuild a single page.

Thanks for your time.

w3c validator (on text input) inserts <html lang=''><!DOCTYPE html> following the <!DOCTYPE html> that already exists in page source.

Also shows a non-existent </style> tag after </html> that is not in page source.

Nancy OShea
Community Expert
Community Expert
September 16, 2018

Are you looking at source code on live server and validating with the online validation service?

The W3C Markup Validation Service

It's possible your web host is adding junk to the page without your knowledge.  GoDaddy has started this recently with their OPT OUT analytics tracking.

Nancy O'Shea— Product User & Community Expert
Known Participant
September 16, 2018

Thanks, Nancy.

As this was a single instance event, I rebuilt the page. It's likely I added a character space or some other inadvertent fumble of the fingers,

Thanks for your time.