• Every time I update WordPress it seems to wreck my W3C valid code! Version 4.2.4 has generated 7 errors Doctype! UTF-8 encoding and JavaScript browser check as well as my cookie notification script. The first two errors are important for browser rendering. Please ADVISE!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What exactly are the issues?

    Thread Starter Layllah

    (@layllah)

    Validation Output: 7 Errors
    Error Line 1, Column 1: no document type declaration; implying “<!DOCTYPE HTML SYSTEM>” <html><body><h2>Checking your browser..<h2><script type=”text/javascript” src=”…

    The checked page did not contain a document type (“DOCTYPE”) declaration. The Validator has tried to validate with a fallback DTD, but this is quite likely to be incorrect and will generate a large number of incorrect error messages. It is highly recommended that you insert the proper DOCTYPE declaration in your document — instructions for doing this are given above — and it is necessary to have this declaration before the page can be declared to be valid.

    Error Line 1, Column 12: document type does not allow element “BODY” here <html><body><h2>Checking your browser..<h2><script type=”text/javascript” src=”…

    The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements — such as a “style” element in the “body” section instead of inside “head” — or two elements that overlap (which is not allowed).

    One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML’s rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML’s “self-closing” tags for “meta” and “link” in the “head” section of a HTML document may cause the parser to infer the end of the “head” section and the beginning of the “body” section (where “link” and “meta” are not allowed; hence the reported error).

    Error Line 1, Column 43: document type does not allow element “H2” here; missing one of “APPLET”, “OBJECT”, “MAP”, “IFRAME”, “BUTTON” start-tag …l><body><h2>Checking your browser..<h2><script type=”text/javascript” src=”/ae…

    The mentioned element is not allowed to appear in the context in which you’ve placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you’ve forgotten to close a previous element.

    One possible cause for this message is that you have attempted to put a block-level element (such as “<p>” or “<table>”) inside an inline element (such as ““, “<span>”, or “<font>”).

    Error Line 1, Column 106: required attribute “TYPE” not specified …cript” src=”/aes.js” ></script><script>function toNumbers(d){var e=[];d.replac…

    The attribute given above is required for an element that you’ve used, but you have omitted it. For instance, in most HTML and XHTML document types the “type” attribute is required on the “script” element and the “alt” attribute is required for the “img” element.

    Typical values for type are type=”text/css” for <style> and type=”text/javascript” for <script>.

    Error Line 1, Column 737: end tag for “H2″ omitted, but its declaration does not permit this …tp://therionsolutions.byethost15.com/Blog/?ckattempt=1”;</script></body></html>

    •You forgot to close a tag, or
    •you used something inside this tag that was not allowed, and the validator is complaining that the tag should be closed before such content can be allowed.

    The next message, “start tag was here” points to the particular instance of the tag in question); the positional indicator points to where the validator expected you to close the tag.

    Info Line 1, Column 40: start tag was here …html><body><h2>Checking your browser..<h2><script type=”text/javascript” src=”…

    Error Line 1, Column 737: end tag for “H2″ omitted, but its declaration does not permit this …tp://therionsolutions.byethost15.com/Blog/?ckattempt=1”;</script></body></html>

    •You forgot to close a tag, or
    •you used something inside this tag that was not allowed, and the validator is complaining that the tag should be closed before such content can be allowed.

    The next message, “start tag was here” points to the particular instance of the tag in question); the positional indicator points to where the validator expected you to close the tag.

    Info Line 1, Column 13: start tag was here <html><body><h2>Checking your browser..<h2><script type=”text/javascript” src=”…

    Error Line 1, Column 744: end tag for “HTML” which is not finished …tp://therionsolutions.byethost15.com/Blog/?ckattempt=1″;</script></body></html>

    Most likely, you nested tags and closed them in the wrong order. For example <p>…</p> is not acceptable, as must be closed before <p>. Acceptable nesting is: <p></p>

    Another possibility is that you used an element which requires a child element that you did not include. Hence the parent element is “not finished”, not complete. For instance, in HTML the <head> element must contain a <title> child element, lists require appropriate list items (

      and
      require

    1. ; <dl> requires <dt> and <dd>), and so on.
    Thread Starter Layllah

    (@layllah)

    As you can see the update to 4.24 caused some disturbing declaration issues, encoding, and script issues.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What happens when you deactivate all plugins and switch to the Twenty Fifteen theme?

    Thread Starter Layllah

    (@layllah)

    The plugins are not the problem, the theme is also not the problem. I know this because before the latest update the site was 100% W3C perfect. The errors W3C validator is generating point to the Doctype declaration reading as html 4.01 transitional when in fact the site is Xhtml 1.0 transitional also the encoding is not reading UTF-8 as a matter of fact the validator now doesn’t understand what the encoding actually is. The other errors are pointing to my site cookie notice script and the RSS widget which I turned off. I noticed some improperly coded ampersands in the core files that were updated. Ampersands need to be coded like this &amp semi-colin or they create errors. Above I noticed a browser checking script which i didn’t install generating errors which didn’t happen with the previous version. At this point I am not sure how to go about correcting these. Any advice would be greatly appreciated. Thanks! FYI 5 of these errors are caused by the aforementioned JavaScript issues. Two f the errors are the Doctype declaration and encoding.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I did check the Twenty Fourteen and Fifteen themes in the W3C validator before I recommended that, neither came up with the errors you describe.

    Can you link us your website?

    Thread Starter Layllah

    (@layllah)

    Not trying to be difficult but there were no errors at all before the latest update. I custom created the theme and it passed the W3C validators CSS and HTML until today when I updated versions. The widgets are all code corrected even Google translate is not proper syntax without editing. Checking the theme without the custom cookie notice script and widgets I corrected won’t generate the errors above. Here’s the link http://therionsolutions.byethost15.com/Blog/. I tried the theme switch and the above errors are still present. I’m pretty sure the update doesn’t like my custom script edits anymore I’m just not sure what to do about it without sacrificing scripts and widgets I like. I use this blog as a sand box and new code technique testing ground so I keep up with the current best code practices. Thanks for your time!

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I believe you, but I don’t think the conclusion that WordPress’ updates are responsible is correct. I’m not just saying that because I want to sound righteous or defend WordPress because I love it so much, but because I think we’d be wasting our time to explore that route.

    I was looking at one of the warnings that the W3C validator came up with before it threw some errors. It seemed to point to the undefined doctype problem:

    Unable to Determine Parse Mode!

    The validator can process documents either as XML (for document types such as XHTML, SVG, etc.) or SGML (for HTML 4.01 and prior versions). For this document, the information available was not sufficient to determine the parsing mode unambiguously, because:

    the MIME Media Type (text/html) can be used for XML or SGML document types
    No known Document Type could be detected
    No XML declaration (e.g <?xml version=”1.0″?>) could be found at the beginning of the document.
    No XML namespace (e.g <html xmlns=”http://www.w3.org/1999/xhtml&#8221; xml:lang=”en”>) could be found at the root of the document.
    As a default, the validator is falling back to SGML mode.

    I’m still not sure what the problem is, but that’s a good lead.

    Thread Starter Layllah

    (@layllah)

    After reading the code error’s generated by the W3C validator the culprit is a GOOGLE AES Script, to be exact aes.js. According to Google Crypto it’s a script designed for safely running JavaScript. This script is generating all 7 errors because it’s syntax is not validator friendly. The funny thing is I did not install this script and have no clue where it came from. The only certainty is when I updated my blog this am this script installed itself. Now I need to find the opening body tag so I can repair the bad syntax. Once this referrer to this script is repaired all the errors will be gone including the !doctype and UTF-8 issues. Thanks for your help.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘JavaScript & W3C Validation errors’ is closed to new replies.