The problem is this "var li = $('#dhtml_menu-' + cookie[i]).parents('li:first');" in the following block:
// Get cookie
if (!effects.siblings) {
var cookie = Drupal.dhtmlMenu.cookieGet();
for (var i in cookie) {
// If the cookie was not applied to the HTML code yet, do so now.
var li = $('#dhtml_menu-' + cookie[i]).parents('li:first');
if ($(li).hasClass('collapsed')) {
Drupal.dhtmlMenu.toggleMenu(li);
}
}
}
Fixes include more strict testing of cookie and the target element's existence.
// Get cookie
if (!effects.siblings) {
var cookie = Drupal.dhtmlMenu.cookieGet();
if (cookie != '') for (var i in cookie) {
// If the cookie was not applied to the HTML code yet, do so now.
if ((cookie instanceof Array) && $('#dhtml_menu-' + cookie[i]).length != 0) {
var li = $('#dhtml_menu-' + cookie[i]).parents('li:first');
if ($(li).hasClass('collapsed')) {
Drupal.dhtmlMenu.toggleMenu(li);
}
}
}
}
Patch against 6.x-3.x-dev is attached. I did see the same problem in both 6.x-3.5 and 6.x-3.x-dev -- I set it to 3.5 as it seems that initially this patch would be more helpful to existing 3.5 users. Maybe update/reassign the version on commit?
Ignore this patch. Get the patch from the comment.
Comments
Comment #0.0
jason.fisher commentedtypo
Comment #0.1
jason.fisher commentedupdated for second correction
Comment #1
jason.fisher commented- ignore
Comment #2
jason.fisher commentedAdded a test for (cookie instanceof Array).
Comment #3
glenshewchuck commentedThankx for the patch - worked perfectly for me :)
Comment #3.0
glenshewchuck commentedadded array test
Comment #4
vuilI closed the issue as Closed (outdated) because it is for unsupported 6.x version of Drupal. Thanks to all of you!