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?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Status: Active » Postponed (maintainer needs more info)

I'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?

psynaptic’s picture

I'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:

<strong id="jquery_version">javascript not enabled</strong>

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.

sun’s picture

Status: Postponed (maintainer needs more info) » Active

Definitely. #2 is the way to go. I'd be happy to commit a patch that implements this.

sun’s picture

Version: 5.x-2.x-dev » 5.x-2.0-rc1
psynaptic’s picture

Assigned: Unassigned » psynaptic
Status: Active » Needs review
FileSize
1.57 KB

Okay, I did a checkout of DRUPAL-5--2 and created a patch.

sun’s picture

Status: Needs review » Needs work

Hm. 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.

psynaptic’s picture

FileSize
1.37 KB

I've read the thread you linked to and ended up creating this patch. Hope I got the right idea.

heddn’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)

Marking 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.