After installing boost, my site does no longer validate as XHTML strict. It seems there are several issues with the HTML generated by boost that the W3C Validator complains about.

First of all, the block "Boost: Pages cache status" generates the following two error messages:

Attribute "content" exists, but can not be used for this element.

document type does not allow element "form" here; missing one of "object", "ins", "del", "map" start-tag

This issues are caused by the following line of XHTML: <span class="boost cache-status" content="7980"><small>Site Has Changed: <em>False</em><br />Expire In: <em>2 hours 13 min</em><br />Cache Generated: <em>0.65</em> seconds<br /> <form action="/" accept-charset="UTF-8" method="post" id="boost-block-flush-form">

Would it be possible to remove or change the "content" attribute and also to wrap the form properly?

The other issues are caused by the line <iframe src="/boost-gzip-cookie-test.html" style="width:0px; height:0px; border:0px; position:absolute; top:-1000px; z-index:10;"></iframe>. Specifically, the W3C does not like:

Attribute "src" exists, but can not be used for this element.
Attribute "style" exists, but can not be used for this element.
element "iframe" undefined. Did you mean "iframe" or "frame"?

Instead of "iframe", I would suggest using "object".

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

netbjarne’s picture

Got the same errors. Latest drupal, acquia slate theme, site xhtml strict validated before boost.. Sad, as boost really boosts :)

1. Error Line 123, Column 206: Attribute "src" exists, but can not be used for this element.

…rupal themes

mikeytown2’s picture

Status: Active » Needs review
FileSize
5.78 KB

Ignore this file; has 2 patches in 1

mikeytown2’s picture

mikeytown2’s picture

Status: Needs review » Fixed

committed

Anonymous’s picture

Version: 6.x-1.17 » 6.x-1.18
Status: Fixed » Active

Thanks very much for this really quick fix - just installed the latest version and the issues are addressed. Unfortunately though this has now created a new issue as the W3C validator now complains:

document type does not allow element "object" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "address", "fieldset", "ins", "del" start-tag

This is caused by the following line: <object classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13" type="text/html" data="/boost-gzip-cookie-test.html" style="width:0px; height:0px; border:0px; position:absolute; top:-1000px; z-index:10;"></object>

Object, it seems, needs to be wrapped. Of the suggested options "p" and "div" seem appropriate to me - perhaps go for a div?

mikeytown2’s picture

Status: Active » Needs review
FileSize
2.68 KB
Anonymous’s picture

Status: Needs review » Reviewed & tested by the community

Applied the patch; works like a charm.
Again, thanks for addressing this so fast!

mikeytown2’s picture

Status: Reviewed & tested by the community » Fixed

committed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

j0nathan’s picture

Subscribing because I think this is not yet in the stable version (actually 1.18).

FiNeX’s picture

Status: Closed (fixed) » Active

confirmed comment #10

Andrew Udvare’s picture

This is still not in stable for me. I have changed the line to put the element in a div.

mikeytown2’s picture

It's in the latest dev. latest dev is a lot better then 1.18

sreyas’s picture

Using the latest dev version date Jan 25th. When checks the for the first time everything is good as expected. But on repeated test HTML validation fails.

Please see the site here.

http://www.urltrim.com

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.urltrim.com%2F&charset=%28detect+automatically%29&doctype=Inline&group=0
B.P.B’s picture

I had the exact same problem as #5.

The fix appears to be very simple. Output the object with a div wrapped around.

Please add this change to the 6.x release.

 // Create or update the static files as needed
  if (($filename = boost_file_path($path, TRUE, $extension)) && (BOOST_OVERWRITE_FILE || !file_exists($filename) || boost_db_is_expired($filename))) {
    // Special handling of the front page for aggressive gzip test
    if ($path == '' && BOOST_AGGRESSIVE_GZIP && $extension == BOOST_FILE_EXTENSION) {
      _boost_generate_gzip_test_file();
      boost_cache_write($filename, _boost_inject_code($data, '<div><object classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13" type="text/html" data="/boost-gzip-cookie-test.html" style="width:0px; height:0px; border:0px; position:absolute; top:-1000px; z-index:10;"></object></div>' . "\n"));
    }
Funksmaname’s picture

thanks #15! this is still an issue that should be looked at... the change #15 mentioned is in boost.module file btw.

janton’s picture

thanks #15

pandymic’s picture

Title: Boost brakes XHTML strict validation » Boost breaks W3 XHTML/HTML5 validation

Further to comments #5 and #15, I just want to report that this solution does not validate as HTML5, due to the removal of the "classid" attribute from the specification.

The fix is as simple as removing the classid attribute entirely from the existing code. This does, however, pose a problem for Internet Explorer users because commonly used versions of the browser rely on the use of "classid"

Therefore the proposed solution requires that IE Conditional comments be used. It's not pretty, but it works.

<!--[if IE]><object classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13" data="/boost-gzip-cookie-test.html" style="width:0px; height:0px; border:0px; position:absolute; top:-1000px; z-index:10;"></object><![endif]-->
<!--[if !IE]><!--><object type="text/html" data="/boost-gzip-cookie-test.html" style="width:0px; height:0px; border:0px; position:absolute; top:-1000px; z-index:10;"></object><!--<![endif]-->

The following PHP code can be applied to the boost.module file. Similar to the original changes, it should replace the code that currently exists on line 2280.

      boost_cache_write($filename, _boost_inject_code($data, '<div><!--[if IE]><object classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13" data="/boost-gzip-cookie-test.html" style="width:0px; height:0px; border:0px; position:absolute; top:-1000px; z-index:10;"></object><![endif]-->' . "\n" . '<!--[if !IE]><!--><object type="text/html" data="/boost-gzip-cookie-test.html" style="width:0px; height:0px; border:0px; position:absolute; top:-1000px; z-index:10;"></object><!--<![endif]--></div>' . "\n"));

This code replaces the code that already exists in boost.module on line 2280

bgm’s picture

Status: Active » Needs review