DISQUS

The Disqus Blog: Fix Validation Errors XHTML Transitional

  • beersage · 1 year ago
    Hey, I just installed the Disqus comments system on my wordpress.org blog and am quite excited. Just wondering if there is a fix to the following validation errors among others? See link at bottom as I think a couple others are related to Disqus.

    #1

    # Error Line 206, Column 688: document type does not allow element "noscript" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag.

    … Supplication Released"><noscript><a href="http://beernews.disqus.com/?ur

    (The error occurs on the ">" sign after "noscript.")

    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 "

    " or "<table>") inside an inline element (such as "", "<span>", or "<font>").

    #2

    # Error Line 277, Column 849: end tag for element "a" which is not open.

    …ews.org/?p=174#disqus_thread">



    (The error occurs on the ">" sign at the second "")

    The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

    If this error occurred in a script section of your document, you should probably read this FAQ entry.

    http://validator.w3.org/check?uri=http%3A%2F%2F...
  • Luke Hoersten · 1 year ago
    I've repackaged the Disqus Wordpress plugin with the changes I've described in the comment below. The new package is available here:
    http://humani.st/fix-disqus-validation-errors-o...
  • Daniel Ha · 1 year ago
    Hey Luke - I'm taking a look at some validators but if you could provide what you know, it'd be helpful.

    Thanks.
  • Luke Hoersten · 1 year ago
    Right now I'm also working with the guy that makes my wordpress theme to debug a sidebar error so I'm toggling Disqus a lot.

    Check out these errors:
    http://validator.w3.org/check?uri=http%3A%2F%2F...

    This is with only Disqus enabled and the page validates without Disqus. I'm assuming, therefore, that all these validation errors are from Disqus. I'm going to try and fix it tonight when I have some time and I'll email you the results. I just wanted to make sure I wasn't replicating your work.
  • Daniel Ha · 1 year ago
    I'll jump on this later today. If you could send me or post your conclusions, that'd be great.
  • Luke Hoersten · 1 year ago
    The fix is simple. Just add /* <![CDATA[ */ ... /* ]]> */ around the javascript (but inside the script tags).

    For example:

    <script type="text/javascript">
    /* <![CDATA[ */
    var disqus_url = 'http://openradix.org/archives/343 ';
    var disqus_title = 'Beginning Blogging';
    var disqus_message = 'There are three key aspects to think about when starting to blog: Finding interesting blogs to read, reading blogs and becoming inspired and reactive, and then writing blog posts.
    %0AReading%0AComparing blogs to physical newspapers, blogs are analogous to individual columns of a newspaper. Physical newspapers have editors who choose the columns and articles to feature each […]%0A';
    /* ]]> */
    </script>


    There's another problem with using <noscript> tags inside of inline elements (in this case you guys have it in a <span>). You can totally hack it by putting <object> tags around it. I'm not sure how semantically correct this is but it works. Once this is handled the Wordpress plugin, at least, should validate.
  • Daniel Ha · 1 year ago
    Thanks Luke, this was very helpful.
  • Luke Hoersten · 1 year ago
    No problem. It wasn't nearly as serious as I originally thought =) I should have known you guys are pros.
  • beersage · 1 year ago
    It was very easy to resolve with Luke's code which literally knocked out every error I had.

    Thanks again.
  • beersage · 1 year ago
    I'm seen an error like this a couple times since upping the new code when trying to make other code changes or additions to the site.

    Warning: Cannot modify header information - headers already sent by (output started at /dir/disqus.php:241) in /dir/pluggable.php on line 689
  • Luke Hoersten · 1 year ago
    Can you be more specific? What "additions or changes" are you trying to make which are resulting in this error and where do you see the error at? My disqus.php doesn't even have a line 241.
  • beersage · 1 year ago
    All set! Sorry for the false alarm.

    It is probable that the error occurred because I either pasted in the new code while the plug-in was active or because I didn't capture all of the new code when I initially pasted.

    Line 241 on the code I pasted in was right after the "function dsqs_bloginfo_url($url) {" whereas line 241 on your code is actually "add_action('admin_footer', 'disqus_warning');. according to NoteTabLight.

    Either way, I advise people to change the code only after de-activating. Maybe that goes without saying for any plug-in. I'm new at this :)

    thanks again
  • Tri · 1 year ago
    Resurrecting this thread because switching on the Disqus plugin for WordPress (v. 2.03-3166) causes some 30 extra XHTML 1.0 Transitional validation errors (on top of 15 I get without Disqus). That's using http://validator.w3.org on http://www.columbiacityblog.com/

    Had Disqus not fixed this in the current version, or is this something else?
  • achernow · 1 year ago
    Had the same validation issues. Swapped in Luke's 2 files and things validate. Can those please be implemented into the official plugin?

    Edit: Scratch that... It totally broke my blog when I switched out the files.

    -Adam