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

jason.fisher’s picture

Issue summary: View changes

typo

jason.fisher’s picture

Issue summary: View changes

updated for second correction

jason.fisher’s picture

StatusFileSize
new812 bytes

- ignore

jason.fisher’s picture

StatusFileSize
new841 bytes

Added a test for (cookie instanceof Array).

glenshewchuck’s picture

Thankx for the patch - worked perfectly for me :)

glenshewchuck’s picture

Issue summary: View changes

added array test

vuil’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

I closed the issue as Closed (outdated) because it is for unsupported 6.x version of Drupal. Thanks to all of you!