Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've noticed this in passing before but have come back to it because I was looking to include the same thing in my module.
In jquery_update.install hook_requirements:
<?php
elseif ($phase == 'runtime') {
$requirements['jquery'] = array(
'title' => $t('jQuery Update'),
'description' => $t('The current installed version of jQuery is !version', array('%core' => 'misc/jquery.js', '%mod' => $path, '!version' => '<strong><script>document.write($().jquery);</script><noscript>javascript not enabled</noscript></strong>')),
'severity' => REQUIREMENT_OK,
'value' => $t('Installed correctly'),
);
}
?>
The !version is not getting written to the page. On the status page it just says:
The current installed version of jQuery is
Any ideas why this might be?
Comment | File | Size | Author |
---|---|---|---|
#7 | jquery_update_version.patch | 1.37 KB | psynaptic |
#5 | jquery_update_version.patch | 1.57 KB | psynaptic |
Comments
Comment #1
sunI'm not able to replicate this bug. Which other modules do you have installed and did you test this with other browsers? What browser platform are you working on?
Comment #2
psynaptic CreditAttribution: psynaptic commentedI've figured out the cause of this problem.
In the theme I'm using (blueprint), the scripts are at the bottom of the page rather than in the header. This was done for performance reasons. I've moved the scripts to the header and it works again.
I tried to find a solution but couldn't devote enough time to it, sorry.
I guess you could start with:
and then when the document is ready, replace the content with the jQuery version. You could put it in compat.js. Just thinking out loud.
Comment #3
sunDefinitely. #2 is the way to go. I'd be happy to commit a patch that implements this.
Comment #4
sunComment #5
psynaptic CreditAttribution: psynaptic commentedOkay, I did a checkout of DRUPAL-5--2 and created a patch.
Comment #6
sunHm. I don't think it's a good idea to place this code in compat.js, and thus, load and execute it on each and every page request. Let's move it into an inline JavaScript that gets output in the header or footer. When doing this, we should take #158992: Inline JavaScript is XHTML invalid into account.
Comment #7
psynaptic CreditAttribution: psynaptic commentedI've read the thread you linked to and ended up creating this patch. Hope I got the right idea.
Comment #8
heddnMarking this as won't fixed. 5.x is no longer supported/maintained. If this is still an issue in 7.x, then please re-open.