Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script Error at Internet Explorer 11 with Version 3.x #41

Closed
liquid-a opened this issue Sep 17, 2019 · 11 comments
Closed

Script Error at Internet Explorer 11 with Version 3.x #41

liquid-a opened this issue Sep 17, 2019 · 11 comments

Comments

@liquid-a
Copy link

I have a script Error when i usw the mmenu.js with version 3.0.1 or 3.0.2

The console shows:
SCRIPT1002: Syntaxfehler
Datei: mmenu.js, Zeile: 1, Spalte: 2278

The menu is not functional with IE 11. No Problems with Firefox or Chrome.

When i use Verison 2.1.1 everything ist O.K.

@fritzmg
Copy link
Collaborator

fritzmg commented Sep 17, 2019

mmenu in general is not compatible with IE 11. There is a PR for automatically including Polyfills though: #40
I'll release it as 3.1.0 today.

@Defcon0
Copy link
Contributor

Defcon0 commented Oct 1, 2019

The problem here is with

document.addEventListener(
        "DOMContentLoaded", () => {
            new Mmenu('#<?= $this->elementId ?>', <?= json_encode($this->options) ?>, <?= json_encode($this->configuration) ?>);
        },
    );

being the js-template for loading the menu. Why not simply use function() {} instead of () => {} not working in IE11?

@Defcon0
Copy link
Contributor

Defcon0 commented Oct 1, 2019

Also the trailing comma leads to a syntax error in IE11. So the more compatible version would be:

document.addEventListener(
        "DOMContentLoaded", function() {
            new Mmenu('#<?= $this->elementId ?>', <?= json_encode($this->options) ?>, <?= json_encode($this->configuration) ?>);
        }
    );

@fritzmg
Copy link
Collaborator

fritzmg commented Oct 2, 2019

Yeah, I can optimize this. Also it was a mistake to call the template js_mmenu, as it is not a JavaScript Template that can be included in the page layout.

The code is directly pulled from the documentation of mmenu btw.

@operatorone
Copy link

Is it already working in IE11. i just implemented the module and activated the polyfill, but the navigation is jut thrown on the page and the trigger doesn't work.

@fritzmg
Copy link
Collaborator

fritzmg commented Nov 15, 2019

@operatorone the problems mentioned by @Defcon0 have not been fixed yet.

@contaoacademy
Copy link

@fritzmg Do you know, when you can fix this?

@fritzmg
Copy link
Collaborator

fritzmg commented Dec 16, 2019

@contaoacademy pls create a justom js_mmenu template and replace

document.addEventListener(
"DOMContentLoaded", () => {
new Mmenu('#<?= $this->elementId ?>', <?= json_encode($this->options) ?>, <?= json_encode($this->configuration) ?>);
},
);

with:

    document.addEventListener(
        "DOMContentLoaded", function() {
            new Mmenu('#<?= $this->elementId ?>', <?= json_encode($this->options) ?>, <?= json_encode($this->configuration) ?>);
        }
    );

If this change works, then I'll change it immediately.

@contaoacademy
Copy link

error
I get this error

@contaoacademy
Copy link

After using the polyfill option the fix works.

@fritzmg fritzmg closed this as completed Feb 9, 2020
@fritzmg
Copy link
Collaborator

fritzmg commented May 13, 2020

@contaoacademy pls create a justom js_mmenu template and replace

document.addEventListener(
"DOMContentLoaded", () => {
new Mmenu('#<?= $this->elementId ?>', <?= json_encode($this->options) ?>, <?= json_encode($this->configuration) ?>);
},
);

#53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants