Remove more Bootstrap from the main bundle
What does this MR do and why?
This removes more of Bootstrap JS from our main bundle, resulting in a 2.3% drop in size
Modal
Instantiation methods
Regular expressions
-
rg "toggle\b\W{1,7}\bmodal" {ee/,}app
finds~/profile/gl_crop.js
. -
rg "bs\.modal" {ee/,}app
: finds~/profile/gl_crop.js
.
Button
Instantiation methods
$(...).button(...)
click.bs.button.data-api
,[data-toggle^="button"]
(focus|blur).bs.button.data-api
,[data-toggle^="button"]
load.bs.button.data-api
Regular expressions
-
rg "toggle\b\W{1,7}\bbutton" {ee/,}app
finds things which include "toggle-button" which aren't relevant. -
rg "bs\.button" {ee/,}app
finds nothing. -
rg "\.button\(" {ee/,}app
finds nothing.
Alert
Instantiation methods
Regular expressions
-
rg "dismiss\b\W{1,7}\alert" {ee/,}app
finds things which include "toggle-button" which aren't relevant. -
rg "bs\.alert" {ee/,}app
finds nothing. -
rg "\.alert\(" {ee/,}app
finds one false positive.
Collapse
Instantiation methods
Regular expressions
-
rg "\.collapse\(" {ee/,}app
finds several false positives (example), but also some genuine ones: -
rg "bs\.collapse" {ee/,}app
findsee/pages/projects/settings/repository/show/ee_mirror_repos.js
-
rg "toggle\b\W{1,7}\bcollapse" {ee/,}app
finds only false positives (example).
Screenshots or screen recordings
Avatar cropping:
simplescreenrecorder-2023-03-21_12.29.36
Avatar cropping error handling:
simplescreenrecorder-2023-03-21_12.12.56
KaTeX alert dismissal:
simplescreenrecorder-2023-03-21_13.23.58
How to set up and validate locally
Avatar cropping
- Visit the Edit Profile page
- Choose a new avatar
- Observe modal appears
- Observe saving the cropped image works
KaTeX rendering alert
- Apply this patch:
diff --git a/app/assets/javascripts/behaviors/markdown/render_math.js b/app/assets/javascripts/behaviors/markdown/render_math.js index b2348cf0bad6..040fd202ddfd 100644 --- a/app/assets/javascripts/behaviors/markdown/render_math.js +++ b/app/assets/javascripts/behaviors/markdown/render_math.js @@ -14,7 +14,7 @@ import { unrestrictedPages } from './constants'; const MAX_MATH_CHARS = 1000; const MAX_MACRO_EXPANSIONS = 1000; const MAX_USER_SPECIFIED_EMS = 20; -const MAX_RENDER_TIME_MS = 2000; +const MAX_RENDER_TIME_MS = 0; // Wait for the browser to reflow the layout. Reflowing SVG takes time. // This has to wrap the inner function, otherwise IE/Edge throw "invalid calling object".
- Copy this KaTeX into a comment in an issue (for example).
- Observe alert behaviour is intact.
- Ignore
<copy-code>
element appearing over alert close button; it's an existing bug.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Mark Florian