Posts Tagged ‘validation’

Validating WordPress Single Post

Error Line 117, Column 95: there is no attribute “aria-required”

…me=”author” id=”author” value=”" size=”22″ tabindex=”1″ aria-required=’true’ />

Ever since this line was in the comments.php, my blog no longer validates.
I have always ignored it.
If it benefits the visitors, I’ll live with it.

But suddenly, this Invalid Markup bothers me today. It must have been 2 years.
Someone must have moved too fast and someone else moved too slow.
2 years and still behind. It must be a case of :

  • It is not important
  • It is important but is not urgent
  • It is important and urgent but does not required immediate attention and action

So I opened up comment.php and search for <aria-required> I found these 2 lines:

<p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p>
<p><input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p>

I had these 2 lines of php code removed

<?php if ($req) echo "aria-required='true'"; ?>

Now there’s a line that says
<?php if ($req) echo "(required)"; ?>

I don’t understand PHP but I feel this line should go too.

Since it’s done, I’ll go fill in a comment and see if there’s anything wrong.

It’s good the see this line again:

This document was successfully checked as XHTML 1.0 Transitional!

Validating Google Custom Search

Finally I am able to have every page passed the XHTML validation.

Previously, one line didn’t validate. It was a code supplied by Google:

<style type="text/css">
@import url(http://www.google.com/cse/api/branding.css);
</style>

This code shouldn’t be in the content area.

I could have the page validated by moving this style link to the <head> section – there’s where it should be. However that would violates the Adsense TOS.

While doing a search I came across this WebMasterWorld Forum when a member discovered the solution after posting about this problem.

Instead of moving the code, the simple solution is to select a different set of code provided by Google; i.e. to opt for the search box that says Note: Watermark requires JavaScript.

Adsense search selection

Sure enough, with this code changed, it now validates.

Validating Google’s Adsense For Search

Finally completed the xhtml validation codes for the first six pages.

If pages were written in a rush, it is easy to forget to close all the tags.

One code, however, remains in error.

That was a code given by Google’s Adsense for search:

The Markup Validation Service Report

Validation Output: 1 Error

1. Error Line 20, Column 23: document type does not allow element “style” here

<style type="text/css">

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).

Good to hack it?

One way is get around it is perhaps to move this line of code inside the head element.

<style type="text/css">
@import url(http://www.google.com/cse/api/branding.css);
</style>

But then, that would be breaking the Google’s TOS.
Better not touch it since everything is working in order.