template_default jQuery loader does not validate at http://validator.w3.org
I am not sure this is officially a "bug report" or not, but posting it here for lack of a better place to do it
Vanilla install of 1.5.4 gives me 11 errors and 5 warnings as posted by Melanie Prough in another thread. Validation report is here:
HOWEVER, if I use CSS JS loader on my install, i get a clean validation with no errors.
My problem is that I am worried that the code in includes/templates/template_default/common/html_header.php which is causing all the validation errors - specifically:
Code:
/** CDN for jQuery core **/
?>
<script>window.jQuery || document.write('<script src="//code.jquery.com/jquery-1.11.1.min.js"><\/script>');</script>
<script>window.jQuery || document.write('<script src="<?php echo $template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript'); ?>/jquery.min.js"><\/script>');</script>
is not being called when using css js loader and that this has something to do with PCI compliance and is necessary code.
If I move the 1.5.4 core includes/templates/template_default/jscript folder into the classic directory, I get one error
as can be seen here
Can you help? I have a new site for a client scheduled today and I do not want to do it in 1.5.4 if there are going to be validation errors, or if my installing the css js loader is going to break PCI compliance if that is what these scripts are being used for.
Thanks to anyone who can help!
Re: template_default jQuery loader does not validate at http://validator.w3.org
The <script> syntax is perfectly valid for HTML5.
(and yes, I understand that ZC v1.5.4 ships with an XHTML template).
So ... if you're not putting an HTML5 template onto your site and you need it to pass XHTML validation in the W3C validator,
then there are 2 sets of changes to make:
1. /includes/templates/template_default/jscript/jscript_framework.php, line 9:
Code:
<script type="text/javascript">
and line 15:
Code:
options.url = options.url.replace("&", unescape("&"));
and line 67:
Code:
if (jqXHR.status === 200 * contentType.toLowerCase().indexOf("text/html") >= 0) {
2. /includes/templates/template_default/common/html_header.php, around line 106 change this:
Code:
/** CDN for jQuery core **/
?>
<script>window.jQuery || document.write('<script src="//code.jquery.com/jquery-1.11.1.min.js"><\/script>');</script>
<script>window.jQuery || document.write('<script src="<?php echo $template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript'); ?>/jquery.min.js"><\/script>');</script>
to this:
Code:
/** CDN for jQuery core **/
?>
<script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript type="text/javascript" src="//code.jquery.com/jquery-1.11.1.min.js"%3E%3C/script%3E'));</script>
<script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript type="text/javascript" src="<?php echo $template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript'); ?>/jquery.min.js"%3E%3C/script%3E'));</script>
Re: template_default jQuery loader does not validate at http://validator.w3.org
(Unfortunately, the way the W3C validator assesses things (and ostensibly also the XHTML spec), it's not just a simple matter of adding type="text/javascript" to the <script> tags. Hence the reworked post above, and removal of prior discussion.)
Re: template_default jQuery loader does not validate at http://validator.w3.org
Got it THANKS TONS!! This helps me TREMENDOUSLY with upgrading sites that do not have html5 templates! I was also able to incorporate the js code into css js loader's html_header.php file.
Re: template_default jQuery loader does not validate at http://validator.w3.org
Quote:
Originally Posted by
stellarweb
Got it THANKS TONS!! This helps me TREMENDOUSLY with upgrading sites that do not have html5 templates! I was also able to incorporate the js code into css js loader's html_header.php file.
If you are using the css js loader, then you do not need to put those line in the html_header.php file. You can set the jquery files through the autoloader files
Re: template_default jQuery loader does not validate at http://validator.w3.org
I've always had bad experiences using the css/js loader addons. Total chaos and impossible upgradability.
Re: template_default jQuery loader does not validate at http://validator.w3.org
Quote:
Originally Posted by
DrByte
I've always had bad experiences using the css/js loader addons. Total chaos and impossible upgradability.
That's debatable :) I know most people do not like it, but I have always been a fan of it. Once you get used to it, it is easy to work with, and I find it to have better control over what files you want to load and when.