Commit 76644af
committed
refactor(js): replace deprecated jQuery shorthand event methods with
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/.on() and .trigger()
1 parent 71c8019 commit 76644af
1 file changed
Lines changed: 14 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
| 46 | + | |
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
| |||
115 | 114 | | |
116 | 115 | | |
117 | 116 | | |
118 | | - | |
| 117 | + | |
119 | 118 | | |
120 | 119 | | |
121 | 120 | | |
| |||
181 | 180 | | |
182 | 181 | | |
183 | 182 | | |
184 | | - | |
| 183 | + | |
185 | 184 | | |
186 | 185 | | |
187 | | - | |
| 186 | + | |
188 | 187 | | |
189 | 188 | | |
190 | 189 | | |
191 | 190 | | |
192 | 191 | | |
193 | | - | |
| 192 | + | |
194 | 193 | | |
195 | 194 | | |
196 | 195 | | |
197 | | - | |
| 196 | + | |
198 | 197 | | |
199 | 198 | | |
200 | 199 | | |
| |||
220 | 219 | | |
221 | 220 | | |
222 | 221 | | |
223 | | - | |
| 222 | + | |
224 | 223 | | |
225 | 224 | | |
226 | 225 | | |
227 | 226 | | |
228 | 227 | | |
229 | | - | |
| 228 | + | |
230 | 229 | | |
231 | 230 | | |
232 | | - | |
| 231 | + | |
233 | 232 | | |
234 | 233 | | |
235 | 234 | | |
| |||
491 | 490 | | |
492 | 491 | | |
493 | 492 | | |
494 | | - | |
| 493 | + | |
495 | 494 | | |
496 | 495 | | |
497 | 496 | | |
| |||
545 | 544 | | |
546 | 545 | | |
547 | 546 | | |
548 | | - | |
| 547 | + | |
549 | 548 | | |
550 | 549 | | |
551 | 550 | | |
| |||
648 | 647 | | |
649 | 648 | | |
650 | 649 | | |
651 | | - | |
| 650 | + | |
652 | 651 | | |
653 | 652 | | |
654 | 653 | | |
| |||
780 | 779 | | |
781 | 780 | | |
782 | 781 | | |
783 | | - | |
| 782 | + | |
784 | 783 | | |
785 | 784 | | |
786 | 785 | | |
787 | 786 | | |
788 | | - | |
| 787 | + | |
789 | 788 | | |
790 | 789 | | |
791 | 790 | | |
| |||
0 commit comments