Recent Comments widget causes invalid XHTML
The use of Recent Comments sidebar widget causes invalid XHTML. I have put a post and included screenshot of the error message. It seems to be related to inclusion of style element in the widget.
What page are you testing?
Where’s the screen shot?
What level of HTML are you testing it against?
IIRC, it should also give you a line number as well as to where the error occurs.
I am testing the homepage, the current theme is Almost Spring, I tested it with couple of other themes too. The exact error is:
Error Line 857 column 22: document type does not allow “style” element here. I have put a screenshot of the error in the post mentioned in this thread.
Currently I have removed the Recent Comments widget from my sidebar.
Well, if it’s kicking out on line 857, I would say that it’s because the style call is within the body of the page instead of the header. (Much like the explaination mentions.)
Without knowing how WP sticks in the widget code into the output, there’s not a whole lot I myself can tell you. You may want to send in a feedback specifially pointing them to this thread so that they can take a look at it. Hopefully they can slide the style line into the header and fix the issue.
For reference, you should see how your home page seriously breaks the Basic 1.0 test. (Your site is set for 1.0 Transitional though.)
I discovered that on my blog as well. It always kicks out errors when it’s empty. In other words, the error will go away (at least on some of the templates) if there’s a posted comment listed in the recent comments box, but it will always have an error when there’s nothing there.
Actually, the same thing happens to almost all the page elements when they’re empty. Whoever designed these templates didn’t consider what would happen if nothing was there yet, only what to do once the element was populated.
Yes, I had guessed that the style element was misplaced. I have sent the feedback.
Got an immediate reply from WordPress team (Andy Skelton) that this will be fixed in an update soon.
The topic ‘Recent Comments widget causes invalid XHTML’ is closed to new replies.