| Project: | Boost |
| Version: | 6.x-1.18 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
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".
Comments
#1
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
#2
Ignore this file; has 2 patches in 1
#3
this is the correct patch; using this trick
http://intranation.com/test-cases/object-vs-iframe/
http://aplus.rs/web-dev/insert-html-page-into-another-html-page/
#4
committed
#5
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:
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?
#6
#7
Applied the patch; works like a charm.
Again, thanks for addressing this so fast!
#8
committed
#9
Automatically closed -- issue fixed for 2 weeks with no activity.
#10
Subscribing because I think this is not yet in the stable version (actually 1.18).
#11
confirmed comment #10
#12
This is still not in stable for me. I have changed the line to put the element in a div.
#13
It's in the latest dev. latest dev is a lot better then 1.18
#14
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#15
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 neededif (($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"));
}
#16
thanks #15! this is still an issue that should be looked at... the change #15 mentioned is in boost.module file btw.
#17
thanks #15
#18
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
#19