Occurs in /sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.js

Drupal.admin.behaviors.toolbarActiveTrail = function (context, settings, $adminMenu) {
  if (settings.admin_menu.toolbar && settings.admin_menu.toolbar.activeTrail) {
    $adminMenu.find('> div > ul > li > a[href=' + settings.admin_menu.toolbar.activeTrail + ']').addClass('active-trail');
  }
};

Should be:

Drupal.admin.behaviors.toolbarActiveTrail = function (context, settings, $adminMenu) {
  if (settings.admin_menu.toolbar && settings.admin_menu.toolbar.activeTrail) {
    $adminMenu.find('> div > ul > li > a[href$="' + settings.admin_menu.toolbar.activeTrail + '"]').addClass('active-trail');
  }
};

Here is why:
href value must be quoted
href= is absolute (s exactly).

From testing I believe this should actually be $= (ends with).

Anywho, this gets rid of error for me. Awesome module

Comments

magnusk’s picture

Priority: Minor » Normal

I get a similar error message (reported by Safari's Error Console), having upgraded to jQuery 1.5.2.

conspirolog’s picture

I've got the same error. The fix provided in topic helps me.

sun’s picture

Status: Active » Fixed

Thanks for reporting, reviewing, and testing! Committed this change to D7.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

The $ isn't required, as the URLs are supposed to be identical.

WillHall’s picture

I found that when it was installed in a subfolder the $ was necessary.

That could have been a fluke I guess.

Thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sonictruth’s picture

This bug is still in 7.x-3.0-rc1 which was rolled 3 days ago despite this issue being closed since May 19 2011. Anybody know what's up with this?

natashamurphy’s picture

I also had this problem with the latest release: 7.x-3.0-rc1 (downloaded 5 minutes ago).

Fix in the post title worked for me as well.

sonictruth’s picture

Status: Closed (fixed) » Active

Changing the status back to active because I don't think it's fixed.

Ryan258’s picture

I had it working just fine, then I was doing some CSS3 where I ran into some xlayout ylayout errors that appeared to be attributed to jQuery. Just installed and activated jQuery and now I'm without a bar and have this very syntax error. Anyone else fiddling with their jQuery update when their admin bar went missing?

corbacho’s picture

Status: Active » Closed (fixed)

This was fixed by sun in May 2011

@sonictruct
It wasn't rolled some days ago
Notice that the last stable release (currently 7.x-3.0-rc1) is more than 1 year old :)

The 2 solutions you have: download the 7.x dev version or fix it manually by adding double quotes (the dollar sign is not needed)

See the commit-diff
http://drupalcode.org/project/admin_menu.git/commitdiff/74aa1f13ba06cd4b...

Let's not open this again.

JSCSJSCS’s picture

I have one website D7 website that I did not install Jquery Update on and another that I did. The one with the Update module was not getting the active-trails classes in the visited menu item. The website which never installed the jquery update module worked correctly.

I manually updated the admin_menu_toolbar.js file as suggested here on a lark, as I was not getting any errors, but I was not seeing the toolbar.png on the active link. It fixed my issue.

I suspect that when I do add jquery update module to the other website, I will get the same issue.

The question is, should I update that site's admin_menu_toolbar.js file too or will it blow up without a current version of jquery.js?

corbacho’s picture

@JSC
If you see, the jQuery selectors asks to use double quotes. The weird thing is that was working before

So yes, you can patch the admin_menu_toolbar.js in any site (with or without the jquery_update) and it will work.

JSCSJSCS’s picture

@corbacho, thanks for the reply! I feel better making the edit to all my sites.

fenstrat’s picture

Just a note if you need to patch 7.x-3.0-rc1 to fix this issue the commit-diff and corresponding patch mentioned in #10 doesn't apply cleanly as the CHANGELOG.txt hunk fails to apply. Instead you can use the diff for just admin_menu_toolbar.js which applies cleanly and has the changes needed to fix this issue.