Download & Extend

Javascript error in suckerfish.js

Project:Salamander Skins
Version:6.x-1.1
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:needs review

Issue Summary

If there is nothing in suckerfish area, the assignment

var sfEls = document.getElementById("suckerfishmenu").getElementsByTagName("LI");

fails because getElementById() returns null. IE7 complaints for this but with no apparent consequences.

To solve this small issue simply insert this test before the declaration:

if (document.getElementById("suckerfishmenu") == null)
return;

Comments

#1

Thank you very very very much for this beautiful n important solution. I love this theme a lot. it is more beautiful than any other premium Drupal themes, then why should we waste our money? Thank you

#2

Status:active» needs review

Yes, thank you. This was also the fix I needed. However, I am working with Drupal 6.x and using IE 8 - and this is a year after the last post noticed the issue.

I changed my suckerfish.js by inserting:

if (document.getElementById("suckerfishmenu") == null) return;

as show below:

sfHover = function()
{if (document.getElementById("suckerfishmenu") == null) return;
var sfEls = document.getElementById("suckerfishmenu").getElementsByTagName("LI");

#3

wow, this worked great for me, saved me hours of IE 7 "hair pulling".

One additional thing, in my case I had "Optimize JavaScript files" (under /admin/settings/performance) set to yes so I needed to clear my site cache to get the new updated script to render into the cached JS file. In my case I was using a custom theme but the code still worked.