-
-
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
Use Strict. Expose all the problems. #6509
Conversation
I have something here that deals with the semi-colons #6106 |
That's good. There are also several cases of undeclared variables. Beyond what's exposed by 'use strict', most of this code violates Joomla's js style rules. Also, a lot of it could simply be better written. |
Oh, and line 37 is just plain wrong. |
That line came from #3484, but why do you say it’s wrong? |
Somehow it must have gotten changed since then. Look again. |
Michaels fixed line 37 directly in core! |
@okonomiyaki3000 👍 |
} | ||
}; | ||
|
||
}(Joomla)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also you can add here (window, document, Joomla)
and on the top also,
then js minifier will minify all window, document, Joomla
variables in the script body 😉
@Fedik this PR fixes nothing and is not meant to fix anything. It only exposes some of what needs to be fixed. Your points are correct but I won't do anything about them here. |
#6512 merged, this PR can be closed. Thanks @okonomiyaki3000! |
Hey, y'all, don't accept this PR, it breaks things. Actually, it exposes things that are already broken.
I've wrapped the whole thing in a closure and set it to use strict. Then, because some functions need to be in the global scope, I changed them from function statements to function expressions and attached them to window. Other than those changes, this file hasn't been changed.
Now go ahead and try to use it. You'll need to be in debug mode (so you get the uncompressed file) and then go to the admin and try to do some admin stuff. For example, in any list view you can try:
You'll probably want to have your browser's console open while you do this stuff. You'll likely notice that:
a) it doesn't work
b) the console shows some errors
This is here to start a discussion but I've also got most of the fixes already done which I'll be submitting later.