-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
validate.js throws Uncaught SyntaxError: redeclaration of const errors #43714
Comments
Note: Strict mode should be restored, for the script, In joomla 4.4 |
I looked into how others have used punycode and modified validate.js to the following which appears to work and fixes the error. /** Bootstring parameters */ /** Regular expressions */ /** Error messages */ /** Convenience shortcuts */ /--------------------------------------------------------------------------/ /**
/**
/**
/**
/**
/**
/**
/**
/**
}; /**
}; /**
/**
/--------------------------------------------------------------------------/ /** Define the public API /
// eslint-disable-next-line class-methods-use-this
} // eslint-disable-next-line class-methods-use-this
} // eslint-disable-next-line class-methods-use-this
}
}
}
}
} // Cleanup |
Change
to "type": "module" |
Not really, the script/file was supposed to be ESM thus strict by default, reduced scoped (the reported issue), etc. but unfortunately the script was loaded as legacy js file with attribute |
yes, and no. type=module can be only in future 5.x or 6.x idk, as feature not bugfix |
okay, it is a horrible bug, also affect core js |
There are PRs for this so it should be closed |
Steps to reproduce the issue
Display a form and use webassets to use script form.validate
Expected result
script works with no errors in console.log
Actual result
Uncaught SyntaxError: redeclaration of const errors is displayed in console.log
System information (as much as possible)
Tested on 5.0 and 5.1.1, discussed on Extension development room and @Fedik requested an issue raised.
Additional comments
Fedir Zinchuk
It a bug in validate.js, the code should be wrapped in to anonimous function or use type module
please open an issue
The text was updated successfully, but these errors were encountered: