Closed (works as designed)
Project:
Superfish Dropdown Menu
Version:
7.x-1.8
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Aug 2011 at 06:12 UTC
Updated:
3 Oct 2012 at 21:41 UTC
Investigating slow pages in http://drupal.org/node/1235408. Found the Superscript inline Javascript twice. I assume part of the slowdown would be the Superfish function running twice. As a quick fix, I added the following code and the Javascript appeared once instead of twice.
function superfish_contents($delta = 0) {
global $language;
static $superfish_javascript_added;
if(empty($superfish_javascript_added))
{
$superfish_javascript_added = true;
drupal_add_js($javascript, array('type' => 'inline', 'weight' => 100));
}
The CSS appears only once. I think Drupal ignores duplicate inclusion of files but not duplicate inclusion of inline code. Perhaps the duplicate prevention could be wrapped around the whole process to reduce duplicate processing overhead.
The page uses fusion starter subtheme with only a few changes to the CSS. None of the other processing is changed. Why would the superfish_contents function fire twice?
Comments
Comment #1
mehrpadin commentedHey Peter,
No duplicates there, you probably have two Superfish blocks.
Comment #2
peterx commentedOne navigation block in the sidebar. One superfish block in the header. I added a trace to the code. When the superfish block is on, the superfish_contents function runs twice. When the superfish block is off, the code runs once. It is the Superfish block running the superfish_contents function twice.
Comment #3
peterx commentedI found the error occured with Fusion but not with Zen as the base theme.
Comment #4
mehrpadin commentedComment #6
avb commentedThe same bug is appearing on my site using the fusion theme and having only one superfish block enabled.
Comment #7
mehrpadin commentedServus,
If it's only happening with the Fusion you should ask the developers of the Fusion about this.
Comment #8
mehrpadin commented