Download & Extend

Javascript error causing problems with other modules

Project:SimpleMenu
Version:6.x-1.4
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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?

Comments

#1

The same problem exists with the dev version.

#2

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

#3

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');
}

#4

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;
}

#5

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

AttachmentSize
simplemenu.module.patch 566 bytes

#6

Status:active» needs review

#7

That patch solved the problem for me. Thanks mate.

#8

Status:needs review» reviewed & tested by the community

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

#9

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

#10

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.

#11

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

#12

Status:fixed» closed (fixed)

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

nobody click here