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.
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
Comment #1
magnusk CreditAttribution: magnusk commentedI get a similar error message (reported by Safari's Error Console), having upgraded to jQuery 1.5.2.
Comment #2
conspirolog CreditAttribution: conspirolog commentedI've got the same error. The fix provided in topic helps me.
Comment #3
sunThanks 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.
Comment #4
WillHall CreditAttribution: WillHall commentedI found that when it was installed in a subfolder the $ was necessary.
That could have been a fluke I guess.
Thanks
Comment #6
sonictruth CreditAttribution: sonictruth commentedThis 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?
Comment #7
natashamurphy CreditAttribution: natashamurphy commentedI 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.
Comment #8
sonictruth CreditAttribution: sonictruth commentedChanging the status back to active because I don't think it's fixed.
Comment #9
Ryan258 CreditAttribution: Ryan258 commentedI 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?
Comment #10
corbacho CreditAttribution: corbacho commentedThis 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.
Comment #11
JSCSJSCS CreditAttribution: JSCSJSCS commentedI 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?
Comment #12
corbacho CreditAttribution: corbacho commented@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.
Comment #13
JSCSJSCS CreditAttribution: JSCSJSCS commented@corbacho, thanks for the reply! I feel better making the edit to all my sites.
Comment #14
fenstratJust 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.