-
-
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
[5.2] [bugfix] Use iife for the scripts core and load validate as module #43758
base: 5.2-dev
Are you sure you want to change the base?
Conversation
This is no go, sorry. I would suggest to keep for 5.1 the same what you did for 4.4 (will be upmerged). Please, without this huge code move, that you made in core.js. |
If you have a problems with eslint, just add:
At top of the file. Like we have for TinyMCE
|
I don't see any problems with the change from
In sort this change shouldn't be assumed as a breaking change as it isn't I'll change the |
There no problem to set It is not a big deal, but I would keep it safe, and would not to do such changes in patch release. |
I'm willing to take full responsibility for this if the maintainers trust me 🙋♂️ |
Then I leave you to maintainers 😄 |
Please add one more globals for And then release manages can decide, what to do with the PR. |
Done, I guess you could raise this to the maintainers |
I have tested this item ✅ successfully on 2c1f421 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43758. |
I have tested this item ✅ successfully on 2c1f421 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43758. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43758. |
Hey @dgrammatiko thanks for this PR. Just to understand, isn't this a B/C break, if someone e.g. made an override of the "old" core/validation script and now it's loaded as a module? |
No, type=module means:
the reduced scope in this case is irrelevant as the classes are exposed as global vars. In sort there won’t be any issue! |
Ok, I just saw, that after the upmerge something similar was done in 4.4, could you (@dgrammatiko ) please check, if the changes were correct and if this PR is still needed? Thank you! |
@bembelimen these changes are still better than the code in 4.4. ES modules should be the default way of serving js in 2024... |
I rebased this for 5.2, not sure if this comes to 5.2 or not @bembelimen @Hackwar |
Pull Request for Issue #43714 .
Summary of Changes
Use iife instead of esm for the script core.js and load the script validate.js with a
type=module
Testing Instructions
npm install
Actual result BEFORE applying this Pull Request
Leaking variables in the global scope
Expected result AFTER applying this Pull Request
NO leaking variables in the global scope
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
@Fedik