You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(js): replace deprecated jQuery shorthand event methods with .on() and .trigger()
This commit updates usage of deprecated jQuery event shorthand methods (e.g., `.click()`, `.scroll()`, `.focus()`) with their modern, explicit alternatives: `.on('<event>', ...)` for binding handlers and `.trigger('<event>')` for dispatching events.
- `$(...).scroll(fn)` → `$(...).on('scroll', fn)`
- `$(...).click(fn)` → `$(...).on('click', fn)`
- `$(...).focus()` → `$(...).trigger('focus')`
- Reviewed and replaced similar shorthand usages across the codebase
These shorthand event methods were convenient but are now deprecated due to ambiguity between *event binding* and *event triggering*. For example:
- `$(...).focus()` may either trigger or bind a handler depending on context — a source of confusion and bugs.
- Explicit separation using `.on()` (for binding) and `.trigger()` (for dispatching) improves code clarity and predictability.
These changes align with modern jQuery best practices and are necessary for compatibility with newer versions of jQuery.
Reference: https://api.jquery.com/category/deprecated/
0 commit comments