Hallo, an issue turned up in my queue that exposed a bug in Superfish. Here's the fix: #2330001-5: Custom build conflicting with other javascript

The problem ended up being that there's a line of JS in superfish which checks for Modernizr then assumes that Modernizr.mq() is present. It doesn't always have to be there if someone uses a custom build, so you have to specifically check for that function before invoking it; simply checking for the global Modernizr object is not sufficient. Here's an example:

// See a very simple example at http://jsbin.com/kedifiyatuko/1/edit
if (typeof Modernizr.mq === 'function') {
 // use Modernizr.mq('max-width:' + (breakpoint - 1))
}
else {
  // can't use it if Modernizr.mq === 'undefined'
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bneil’s picture

Status: Active » Needs review

Here's a pull request to change it in the Superfish library: https://github.com/mehrpadin/Superfish-for-Drupal/pull/4

rupl’s picture

Thanks for the quick turnaround! I left my +1 in the PR.

adam-delaney’s picture

I have found an issue relating to site's that do not use the Modernizr library or do not detect for media queries breaking other javascript because the Modernizr object is undefined. I have created a pull request change in the Superfish library for Drupal that resolves the issue. https://github.com/mehrpadin/Superfish-for-Drupal/pull/6

grndlvl’s picture

For those that need a patch

rcodina’s picture

Patch on #4 works for me, but I had to apply it manually. I only applied it to sfsmallscreen.js because it was the only error that was annoying me. Thanks for this.

mehrpadin’s picture

Status: Needs review » Closed (outdated)

Thanks.
For the record: Merged back then.