VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: OpenGlobal on June 06, 2012, 12:25:36 PM

Title: Minor W3C bug fix
Post by: OpenGlobal on June 06, 2012, 12:25:36 PM
One of the javascript declarations breaks W3C compliance according to the W3C validator (although I think this is a bug in the validator rather than Virtuemart) because it contains "HTML" within a script block.


vmSiteurl = 'http://www.willowsshop.co.uk/' ;
vmLang = ""
vmCartText = ' was added to your cart.' ;
vmCartError = 'There was an error while updating your cart.' ;
loadingImage = '/components/com_virtuemart/assets/images/facebox/loading.gif'  ;
closeImage = '/components/com_virtuemart/assets/images/facebox/closelabel.png' ;
Virtuemart.addtocart_popup = '0' ;
faceboxHtml = '<div id="facebox" style="display:none;"><div class="popup"><div class="content"></div> <a href="#" class="close"></a></div></div>'


The last line appears to contain HTML to the W3C validator. The Joomla $document->addScriptDeclaration() function should really add a CDATA block around everything for completeness, but it doesn't.

So a 2 minute cut and paste bug fix would be to change:


                $document = JFactory::getDocument();
                $document->addScriptDeclaration($jsVars);


to:


                $document = JFactory::getDocument();
                $document->addScriptDeclaration("//<![CDATA[\n".$jsVars."\n//]]>");


in administrator/components/com_virtuemart/helpers/config.php in function jPrice().

OpenGlobal