Firefox is throwing a javascript error: "simplemenu is not defined" with a reference to the following line.

var menu = $(simplemenu).attr("id", "simplemenu").addClass('clear-block');

The javascript error is creating problems with the IMCE module. I could not find a patch for this bug. Has anyone else experienced this problem?

CommentFileSizeAuthor
#5 simplemenu.module.patch566 bytesdavidwhthomas

Comments

easp’s picture

The same problem exists with the dev version.

michaelj’s picture

Hi, in file simplemenu.js try add
+ if (typeof(simplemenu) != "undefined") {
var menu = $(simplemenu).attr("id", "simplemenu").addClass('clear-block');
+ }

easp’s picture

I tried the fix above. I receive a different javascript error now which still breaks my module. Error is:

Error: [Exception... "Node cannot be inserted at the specified point in the hierarchy" code: "3" nsresult: "0x80530003 (NS_ERROR_DOM_HIERARCHY_REQUEST_ERR)" location: "http://wwwdev.nebrwesleyan.edu/misc/jquery.js?7 Line: 13"]

It appears the fix broke something in jquery.js

Here is the patch I added to simplemenu.js

if (typeof(simplemenu) != "undefined") {
var menu = $(simplemenu).attr("id", "simplemenu").addClass('clear-block');
}

jrust’s picture

I was having this problem because I had defined some pages not to show the simplemenu under simplemenu's advanced settings.

On those pages where it was not supposed to be showing it was throwing the $(simplemenu) not defined error. Putting this at line 11 fixed it for me:
if (typeof(simplemenu) == "undefined") {
return;
}

davidwhthomas’s picture

StatusFileSize
new566 bytes

I too had this error.

I debugged and found the problem is that simplemenu_init is adding all the javascript on pages where simplemenu is not actually enabled. Because there is no target html element, the js error is thrown.

The attached patch fixes this by checking simplemenu_enabled() before adding the javascript in simplemenu_init

DT

davidwhthomas’s picture

Status: Active » Needs review
jaypan’s picture

That patch solved the problem for me. Thanks mate.

davidwhthomas’s picture

Status: Needs review » Reviewed & tested by the community

Perhaps the patch in #5 could be committed to cvs?

orizu’s picture

Having traced the issues with IMCE to simplemenu_init, this worked for me and is now in play across 3 of my sites. +1 for commit

mikerjohnson’s picture

Comment #4 worked for me. Neither #2 nor #5 resolved the errors I was seeing. Issue was that IMCE was not functional when used from within the rich editor, but did work properly from the "file browser" link from a user's profile.

AlexisWilke’s picture

Version: 6.x-1.2 » 6.x-1.4
Status: Reviewed & tested by the community » Fixed

The patch in #5 is part of 1.4.

Thank you.
Alexis Wilke

Status: Fixed » Closed (fixed)

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