• I have a WordPress 2.1 setup with sidebar widgets.

    The Akismet sidebar widgets seems not to be XHTML valid code:

     Below are the results of checking this document for XML well-formedness and validity.
    
       1. Error Line 261 column 114: document type does not allow element "div" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag.
    
          ...smet.com" title=""><div id="akismet1"><span id="akismetcount">805</span> <spa
    
          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 "<a>", "<span>", or "<font>").
    
       2. Error Line 261 column 218: document type does not allow element "div" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag.
    
          ...ntare</span></div> <div id="akismet2"><span id="akismetbb">blockiert von</spa
    
    
Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Huh. You’re absolutely correct. The Akismet widget is not valid XHTML. You can see they do this:

    <div id="akismetwrap"><div id="akismetstats">
    <a id="aka" href="http://akismet.com" title="">
    <div id="akismet1">
    ...
    </div>
    <div id="akismet2">
    ...
    </div>
    </a>
    </div></div>

    That’s invalid. You cannot put a DIV into an Anchor. Anchor’s can only contain inline elements, DIV is a block level element. They can either try to change those divs into a span (could be tricky, they’re styling them both) or they can move the anchor to inside the divs (probably easier, have to duplicate the anchor though).

    I’ve submitted a ticket to the bugtracker at wp-plugins about this issue.

    Thread Starter tin68

    (@tin68)

    Thanks for your answer. Seems to be an old bug – found an other discussion in wordpress.com from 12-Dez-06.

    Thread Starter tin68

    (@tin68)

    I changed line 602 in akismet.php to

    <div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><span id="akismet1"><span id="akismetcount"><?php echo $count; ?></span> <span id="akismetsc"><?php _e('spam comments') ?></span></span> <span id="akismet2"><span id="akismetbb"><?php _e('blocked by') ?></span><br /><span id="akismeta">Akismet</span></span></a></div></div>

    and it works fine now.

    Tin68, I modified my akismet.php per the code provided. It works great. This appears different than code I saw you post on another thread. I cannot find that thread for the life of me, but thought you might want to update that old post.

    Akismet widget 2.0.2 still not XHTML valid.

    Akismet v. 2.1.3 is also not XHTML valid

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Akismet widget not XHTML valid’ is closed to new replies.