-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Optimize main.js #20093
Optimize main.js #20093
Conversation
why remove comments? |
My code minifier automatically removes them, I can add them back if you'd like?
|
Yes please — the comments have value. |
Sure, I'll add them back later today or tomorrow. I've also fixed my minifier settings, sorry. |
Comments have been added, @SethTisue, would you like me to squash? |
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.
Sorry for the long wait. The changes look good, I just have a few nitpicks.
No problem! Take your time! |
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.
LGTM!
This Pull Request optimizes the functions used in `/docs/_spec/public/scripts/main.js`. ## Changes made: 1. `currentChapter()` function was simplified using `split()` and `pop()` instead of `lastIndexOf()` and `substring()`. 2. Used template literals for string interpolation. 3. Simplified the `heading` function by reducing repetitive code and improving readability. 4. Changed `.removeClass()` and `.addClass()` to `.toggleClass()` for toggling the class based on condition. 5. General cleanup and optimization for better readability and performance.
This Pull Request optimizes the functions used in `/docs/_spec/public/scripts/main.js`. ## Changes made: 1. `currentChapter()` function was simplified using `split()` and `pop()` instead of `lastIndexOf()` and `substring()`. 2. Used template literals for string interpolation. 3. Simplified the `heading` function by reducing repetitive code and improving readability. 4. Changed `.removeClass()` and `.addClass()` to `.toggleClass()` for toggling the class based on condition. 5. General cleanup and optimization for better readability and performance. [Cherry-picked 6d29951]
Backports #20093 to the LTS branch. PR submitted by the release tooling. [skip ci]
This Pull Request optimizes the functions used in
/docs/_spec/public/scripts/main.js
.Changes made:
currentChapter()
function was simplified usingsplit()
andpop()
instead oflastIndexOf()
andsubstring()
.heading
function by reducing repetitive code and improving readability..removeClass()
and.addClass()
to.toggleClass()
for toggling the class based on condition.