cannot declare a let variable twice error in mdb.min.js


Topic: cannot declare a let variable twice error in mdb.min.js

ebebendel pro asked 6 years ago

hi support team, i have a realy simple test scenario: <script src="Scripts/jquery-3.3.1.min.js" type="text/javascript"></script> <script src="Scripts/popper.min.js" type="text/javascript"></script> <script src="Scripts/bootstrap.min.js" type="text/javascript"></script> <script src="Scripts/mdb.min.js" type="text/javascript"></script> $(document).ready(function () { $('.mdb-select').material_select(); ... if i load this simple page i got 2 errors: console.log: cannot declare a let variable twice: "t" ind mdb.min.js TypeError: $('.mdb-select').material_select is not a function. (In '$('.mdb-select').material_select()', '$('.mdb-select').material_select' is undefined) safari browser: cannot declare a let variable twice: "t" ind mdb.min.js TypeError: $('.mdb-select').material_select is not a function. (In '$('.mdb-select').material_select()', '$('.mdb-select').material_select' is undefined) IE11: jQuery.Deferred exception: Das Objekt unterstützt die Eigenschaft oder Methode "material_select" nicht TypeError: Das Objekt unterstützt die Eigenschaft oder Methode "material_select" nicht Das Objekt unterstützt die Eigenschaft oder Methode "material_select" nicht any hints to prevent this error on safari or IE11 Browsers? thx in advance Eberhard

Sebastian Kaczmarek staff pro premium commented 6 years ago

Have you tried using .materialSelect() instead of .material_select() which is deprecated as mentioned in the changelog (https://mdbootstrap.com/changelog/#v4-5-9)?

ebebendel pro answered 6 years ago

Hi Sebastian, tried this out, same error The problem is within the minimized mdb.min.js i tried the same html with full mdb.js and no error is thrown! <script src="Scripts/mdb.js" type="text/javascript"></script> is working well without any error! So how can i avoid the declaration twice error within <script src="Scripts/mdb.min.js" type="text/javascript"></script> ?

ebebendel pro commented 6 years ago

tried mdb.lite.min.js from the new MDB-Pro_4.5.12 work well too!! So declaration problem is in the minimized mdb.min.js

Sebastian Kaczmarek staff pro premium commented 6 years ago

In the 4.5.10 version, there was a bug which was causing this error. It has been fixed with 4.5.11+. So is your problem still occurring?


ebebendel pro commented 6 years ago

yes indeed.
Same Problem with 4.5.11, 4.5.12 and 4.5.13
you can reproduce the issue with safari browser or ie11

actual version 4.5.13 mdb.js line 15477  let inputSelector declaration...

(function ($) {
let inputSelector = ${['text', 'password', 'email', 'url', 'tel', 'number', 'search', 'search-md'].map(function (selector) {
return
input[type=${selector}];
}).join(', ')}, textarea
;


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.5.10
  • Device: independent
  • Browser: ie11/Safari
  • OS: windows/MacOS
  • Provided sample code: No
  • Provided link: No