<style></style> Question

Permalink
Hi guys! I am in the process of building a website for a client and I am running into one weird issue. In the header I am pulling an extra <style> tag with nothing inside of it. I checked my header and it is not in my header element. I believe it is in the header required include.

This is preventing the website from validating with W3C. If anyone could point me in the right direction with removing this it would be much appreciated!

Specs:

Web URL:http://www.imagecontrolbeta.com/isciwny/...

W3C URL:http://validator.w3.org/check?uri=http%3A%2F%2Fimagecontrolbeta.com...

C5 Version: 5.3.3.1

buildingsomethingonline
 
Tony replied on at Permalink Reply
Tony
good catch. looks like that needs to be fixed in the core.

if you'd like to make the fix in your installation, then open /concrete/models/block_styles.php, then in the method addHeaderItems() change the line:

$v->addHeaderItem("<style> \r\n".$blockStylesHeader.'</style>' , 'CONTROLLER');


..to...

if(strlen(trim($blockStylesHeader))) $v->addHeaderItem("<style> \r\n".$blockStylesHeader. '</style>' , 'CONTROLLER');


(there should be no line breaks there)
Remo replied on at Permalink Reply
Remo
this is by the way already fixed in the trunk..
buildingsomethingonline replied on at Permalink Reply
buildingsomethingonline
Thanks! No more empty style tag and invalid code. ^_^
scalait replied on at Permalink Reply
scalait
this is fixed in 5.4 ;-)
mdzoidberg replied on at Permalink Reply
mdzoidberg
Not sure if I'm missing something but i just downloaded the 5.4 version an I was having the same issue, there is no block_styles.php file on the 5.4 version so i keept looking and i found that line 398 of the file collection.php under the concrete/models folder was causing the empty style issue so I made the following change;

$v->addHeaderItem("<style type=\"text/css\"> \r\n".$styleHeader.'</style>', 'VIEW');


To

if(strlen(trim($styleHeader))) $v->addHeaderItem("<style> \r\n".$styleHeader. '</style>' , 'VIEW');


After that the empty style tag disappear, hope I didn't break anything else :)
scalait replied on at Permalink Reply
scalait
as mentioned in many other threads.... Please put this change in c5 code... so that we can close this issue with empty style tags! :-)
ryan replied on at Permalink Reply
ryan
I just committed this to subversion - thx.
scalait replied on at Permalink Reply
scalait
Thank you very much.