-
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 the documentation JS files #20075
Conversation
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.
Hi @RedYetiDev! I should mention now that I am very far from the .js expert, so I may not be up-to-date on the features, or more importantly, the convention used for js code (like which function syntax should be used/is more popular). With that said I'm going to look at this from the scala perspective. Also since the bulk of the changes are concerning syntax changes without any performance improvements, I'm going to be a bit more picky with those (apologies in advance!).
Once the changes are approved, If you'd like, I'll squash before merging |
Okay, would you like me to squash before we merge? |
That's not necessary, I can squash while merging using GitHub UI |
Sounds good! |
This PR optimizes the three files in the `/docs/_assets/js` directory for performance. In `toolbar.js`, jQuery selectors have been cached as variables to prevent constant calls to the DOM. In `sidebar.js`, the multiple `toggleClass(...).toggleClass(...)` have been merged into one In `api-search.js`: - Defined functions have been switched to newer ES format (`const myFunc = () => {}`) - JSON has been switched to **JS**ON (`{"key":"value"}` -> `{key:"value"}`) [Cherry-picked fa2f7bf]
Backports #20075 to the LTS branch. PR submitted by the release tooling. [skip ci]
This PR optimizes the three files in the
/docs/_assets/js
directory for performance.In
toolbar.js
, jQuery selectors have been cached as variables to prevent constant calls to the DOM.In
sidebar.js
, the multipletoggleClass(...).toggleClass(...)
have been merged into oneIn
api-search.js
:const myFunc = () => {}
)regexForTerm
has been switched to ternary{"key":"value"}
->{key:"value"}
)