Skip to content
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

Golf a bit internal/ui/static/js/modal_handler.js #3060

Closed
wants to merge 2 commits into from

Conversation

jvoisin
Copy link
Collaborator

@jvoisin jvoisin commented Jan 4, 2025

  • Re-use an existing function instead of copy-pasting its code
  • Use optional chaining instead of a condition
  • Use the modern .at method instead of [focusableElements.length - 1], as it's supported on all browsers since 2016: https://caniuse.com/mdn-javascript_builtins_string_at

@jvoisin
Copy link
Collaborator Author

jvoisin commented Jan 4, 2025

internal/ui/static/js/modal_handler.js: line 11, col 40, 'Optional chaining' is only available in ES11 (use 'esversion: 11').

ES11 was released 5 years ago, and every browser supports optional chaining since at least 2016

@fguillot
Copy link
Member

internal/ui/static/js/modal_handler.js: line 11, col 40, 'Optional chaining' is only available in ES11 (use 'esversion: 11').

ES11 was released 5 years ago, and every browser supports optional chaining since at least 2016

Fair enough. In that case, the linter and minifier configs can be changed to use ES11.

@jvoisin jvoisin force-pushed the golf_modal branch 3 times, most recently from 09bddc2 to f65c9c8 Compare January 14, 2025 21:01
@jvoisin jvoisin force-pushed the golf_modal branch 3 times, most recently from 1d31778 to 1525b52 Compare January 14, 2025 21:05
- Inline two useless functions
- Use the modern `.at` method instead of `[focusableElements.length - 1], as
  it's supported on all browsers since 2016: https://caniuse.com/mdn-javascript_builtins_string_at
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants