jQuery.fn.scroll() event shorthand is deprecated
Asked Answered
L

1

9

I'm upgrading jQuery in my project to a recent version 3.4.1. I set up jquery-migrate and look in the browser console to see things I should modify. Among others it reads jQuery.fn.scroll() event shorthand is deprecated.

My code is simple: divBody.scroll();.

The documentation says: To trigger the event manually, apply .scroll() without an argument:. I firmly believe this is what I'm doing. Why does migrate still complain?

Limburger answered 20/8, 2019 at 17:44 Comment(1)
For details see future release discussionJeff
S
11

It appears that the documentation has not been updated to reflect the deprecation. See the warning messages for the jQuery Migrate Plugin (specifically the event shorthand deprecations).

Per the solution provided there, the following code should work, removing the deprecation warning:

divBody.trigger("scroll");
Sides answered 20/9, 2019 at 19:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.