Menu icon Foundation
Super expression must either be null or a function, not undefined

Hello,

 

A couple of days ago I updated my Foundation to 6.4.1 via Bower. I'm using Foundation Equalizer and now I'm getting the following error whenever I load the required file for Equalizer (which is foundation.equalizer.js):

Uncaught TypeError: Super expression must either be null or a function, not undefined

The error is generated at line 277, which has the following code:

if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}

Foundation JS is being loaded via the normal way:

$(document).foundation();

Anyone else having the issue? Is there a way to fix it other than downgrading to a previous version?

 

Thanks!

errorEqualizerjsjavascriptbug

Hello,

 

A couple of days ago I updated my Foundation to 6.4.1 via Bower. I'm using Foundation Equalizer and now I'm getting the following error whenever I load the required file for Equalizer (which is foundation.equalizer.js):

Uncaught TypeError: Super expression must either be null or a function, not undefined

The error is generated at line 277, which has the following code:

if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}

Foundation JS is being loaded via the normal way:

$(document).foundation();

Anyone else having the issue? Is there a way to fix it other than downgrading to a previous version?

 

Thanks!

Purdey Chambraud over 1 year ago

Hello,

 

Having the same issue, as usual I am desesperate not seeing any answer to that kind of post.

Why maintaining this forum?

I think you should redirect to your github or stackoverflow or whatever. 

The worst part of it it"s when you google something, you see exactly the same issue you're experiencing month ago by another user and then : no answer, nothing.

I am really sad about it.

 

Sareneathenodny over 1 year ago

I ran into this with `foundation.sticky.js` and `foundation.dropdown.js`.

For whatever reason, the superClass variable is `undefined`, but the `if` clause doesn't check for `undefined`; it only checks for `null`.

I got it to work by adding the following line to the source code, just above the `if (typeof superClass...` clause:

`superClass = !superClass ? null : superClass;`

I suspect an alternative would be to add a third condition to the `if` clause that checks if superClass is not `undefined`.

The down side to this fix is remembering to change the source code again if you upgrade to a later version of Foundation.

Thomas Frobieter 12 months ago

+1 Trying to use magellan for an onepage menu, the error appears twice, first from foundation.smoothScroll.min.js, seond from foundation.magellan.min.js.

No matter if i use data-attributes or creat a new instance in javascript:

var onepageAnchorMenu = new Foundation.Magellan($anchorMenu);

The scripts are implemented in the right order:

  1. foundation.min.js
  2. foundation.smoothScroll.min.js
  3. foundation.magellan.min.js

Thomas Frobieter 12 months ago

Ouh this hurts *facepalm*.

If you read the docs carefully, you will see the required files are:

  1.     foundation.core.js
  2.     foundation.magellan.js
  3.         With utility library foundation.smoothScroll.js

If you have already added the whole bundle >> foundation.js / foundation.min.js, you already have magellan (& smooth scrolling) onboard.

If you add a plugin a second time, this error appears.