User tests: Successful: Unsuccessful:
Pull Request for Issue #43714 .
Use iife instead of esm for the scripts core and validate
npm installconst initialize = 1; and hit Enter.Before: Error SyntaxError: Identifier 'initialize' has already been declared
After: No error
Leaking variables in the global scope
NO leaking variables in the global scope
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
| Status | New | ⇒ | Pending |
| Category | ⇒ | JavaScript Repository NPM Change |
| Title |
|
||||||
| Labels |
Added:
NPM Resource Changed
PR-4.4-dev
|
||
| Labels |
Added:
bug
|
||
hmhm, nope, sorry, it does not work. The variables in the file still globally available.
'use strict' just forcing developer to use var, const, let, and some other litle things.
It should be anonymous function wrapper.
But it is not possible, because we have import punycode from 'punycode'; (this will throw rollup/babel compilation error).
Need to hack the rollup/babel somehow ?
I have no other ideas.
No, Ignore me ?
It works, but, wee need to set some globals back. please add:
window.JFormValidator = JFormValidator;
window.punycode = punycode;Someone may use it in their scripts, even though punycode not officially shipped.
Maybe with some comment, that it will be removed in future.
Classes exposed to the global scope
I have tested this item ✅ successfully on 348daed
For testing.
Open Article editing, open browser console, and type const initialize = 1; and hit Enter.
Before:
Error SyntaxError: Identifier 'initialize' has already been declared
After:
No error;
I have tested this item ✅ successfully on 348daed
| Status | Pending | ⇒ | Ready to Commit |
RTC
| Labels |
Added:
RTC
|
||
| Status | Ready to Commit | ⇒ | Fixed in Code Base |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-08-01 22:15:17 |
| Closed_By | ⇒ | MacJoom |
Thank you!
thanks! I will test it later