error on console "jquery.min.js?v=3.2.1:2 jQuery.Deferred exception: Cannot read property 'add' of null TypeError: Cannot read property 'add' of null"

Created on 19 January 2019, almost 6 years ago
Updated 12 March 2023, almost 2 years ago

i used slick whitout install module and i use edite templete views an regions with class "slick".
but there is a general error in the console that is as follows:

jquery.min.js?v=3.2.1:2 jQuery.Deferred exception: Cannot read property 'add' of null TypeError: Cannot read property 'add' of null
at e.initADA (http://SITENAME.COM/libraries/slick/slick/slick.min.js?plf8a4:15:19553)
at e.init (http://SITENAME.COM/libraries/slick/slick/slick.min.js?plf8a4:15:19320)
at new e (http://SITENAME.COM/libraries/slick/slick/slick.min.js?plf8a4:15:2841)
at r.fn.init.i.fn.slick (http://SITENAME.COM/libraries/slick/slick/slick.min.js?plf8a4:16:11373)
at HTMLDocument. (http://SITENAME.COM/themes/boot_theme/js/default.js?plf8a4:15:40)
at j (http://SITENAME.COM/core/assets/vendor/jquery/jquery.min.js?v=3.2.1:2:29999)
at k (http://SITENAME.COM/core/assets/vendor/jquery/jquery.min.js?v=3.2.1:2:30313) undefined

AND

23 jquery.min.js?v=3.2.1:2 jQuery.Deferred exception: Cannot read property 'add' of null TypeError: Cannot read property 'add' of null
at e.initADA (http://SITENAME.COM/libraries/slick/slick/slick.min.js?plf8a4:15:19553)
at e.init (http://SITENAME.COM/libraries/slick/slick/slick.min.js?plf8a4:15:19320)
at new e (http://SITENAME.COM.ir/libraries/slick/slick/slick.min.js?plf8a4:15:2841)
at r.fn.init.i.fn.slick (http://SITENAME.COM.ir/libraries/slick/slick/slick.min.js?plf8a4:16:11373)
at HTMLDocument. (http://SITENAME.COM.ir/themes/boot_theme/js/default.js?plf8a4:15:40)
at j (http://SITENAME.COM.ir/core/assets/vendor/jquery/jquery.min.js?v=3.2.1:2...)
at k (http://SITENAME.COM.ir/core/assets/vendor/jquery/jquery.min.js?v=3.2.1:2...) undefinedr.Deferred.exceptionHook @ jquery.min.js?v=3.2.1:2k @ jquery.min.js?v=3.2.1:2
jquery.min.js?v=3.2.1:2 Uncaught TypeError: Cannot read property 'add' of null(…)e.initADA @ slick.min.js?plf8a4:15e.init @ slick.min.js?plf8a4:15e @ slick.min.js?plf8a4:15i.fn.slick @ slick.min.js?plf8a4:16(anonymous function) @ default.js?plf8a4:15j @ jquery.min.js?v=3.2.1:2k @ jquery.min.js?v=3.2.1:2

💬 Support request
Status

Fixed

Version

2.0

Component

Miscellaneous

Created by

🇮🇷Iran naeimi20 Tehran

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇦Canada nikathone Ontario

    I am not sure that this error is related to this one but after doing a google and issue search I found this is closest one with what I am facing.
    Mine looks like

    Uncaught TypeError: Cannot read properties of null (reading 'add')
        at e.initADA (slick.min.js?v=1.x:1:19335)
        at e.init (slick.min.js?v=1.x:1:19101)
        at new <anonymous> (slick.min.js?v=1.x:1:2832)
        at i.fn.slick (slick.min.js?v=1.x:1:42781)
        at doSlick (slick.load.js?v=9.5.2:296:7)
        at nn (dblazy.min.js?rpbwad:1:2287)
        at N.once (dblazy.min.js?rpbwad:1:8063)
        at Object.attach (slick.load.js?v=9.5.2:321:12)
        at drupal.js?v=9.5.2:24:24
        at Array.forEach (<anonymous>)

    It started after updating to the latest Drupal slick 2.7.0 from 2.6.0. The slick js library that I am using didn't change (v1.8.1).

    After reading comment #6 I went ahead and updated the module code by applying the following change:

    diff --git a/js/slick.load.js b/js/slick.load.js
    index 9888cca..b20541a 100644
    --- a/js/slick.load.js
    +++ b/js/slick.load.js
    @@ -10,7 +10,7 @@
       var _id = 'slick';
       var _unslick = 'unslick';
       var _mounted = _id + '--initialized';
    -  var _element = '.' + _id;
    +  var _element = '.' + _id + ':not(.' + _mounted + ')';
       var _elSlider = '.slick__slider';
       var _elArrow = '.slick__arrow';
       var _elBlazy = '.b-lazy[data-src]:not(.b-loaded)';
    diff --git a/slick.libraries.yml b/slick.libraries.yml
    index 3da6dbd..6b8b80e 100644
    --- a/slick.libraries.yml
    +++ b/slick.libraries.yml
    @@ -68,7 +68,7 @@ base:
     slick.load:
       version: VERSION
       js:
    -    js/slick.load.min.js: { weight: 0, minified: true }
    +    js/slick.load.js: { weight: 0 }
       dependencies:
         - slick/base
     
    

    and now the error is gone.

    I am not providing a patch because I am not sure if the maintainer is onboard with this approach and I couldn't figured out how to re-generate the slick.load.min.js file.

  • Status changed to Active almost 2 years ago
  • 🇨🇦Canada nikathone Ontario

    I am re-opening this to make sure that the maintainer see my latest update but they should close it in case they feel like this is an isolated problem. I appreciate all the work for the maintainer(s) put into this module.

  • 🇮🇩Indonesia gausarts

    I am fine to re-open it if it happened on the 2.7, and we'll mark it a bug or regression, only after reproduction.

    But what happened if you stick to the project requirements:
    > Slick library (1.6+ and <= 1.8.0)

    ...Important! If any issues with specific number 1.8.0, be sure version in Slick package.json matches the version written in slick.js. The reason, release 1.8.1 with package.json 1.8.1 has also version 1.8.0 written in slick.js as of this writing 2021/10. If they don't match, they are not supported by this module.

    Try lowering your version a bit, and let me know?

  • 🇨🇦Canada nikathone Ontario

    To make sure I understand, I should try slick js library version 1.6+ and <= 1.8.0 with the latest Drupal slick 2.7.0 and report back?

    Thanks for the quick feedback.

  • 🇮🇩Indonesia gausarts

    Yes, please. That will be more contextual.

  • 🇨🇦Canada bsuttis

    I hit this issue after updating to Slick 8.x-2.7

    I can confirm the problem does not exist with 8.x-2.6 and slick.js 1.8.1 but after updating to 8.x-2.7 the problem occurs. I think it's related to the commit referenced in comment #7 (https://git.drupalcode.org/project/slick/-/commit/22fd2e3b8e1203489c023f...).

    In particular, the change of:
    var _element = '.' + _id + ':not(.' + _mounted + ')';

    to:
    var _element = '.' + _id;

    I applied the patch provided in #7 and the error stopped. I was curious if it was an issue with Slick 1.8.1 so I downgraded the module to 8.x-2-6 but the error still occurred. I think this is an issue with the module code and not the Slick JS library.

  • 🇯🇴Jordan mohammedOdeh

    After updating to Slick 8.x-2.7 I hit this issue and "play/pause" buttons still appear after disabling the arrows

  • Status changed to RTBC almost 2 years ago
  • 🇭🇺Hungary lonalore Budapest, Hungary

    Patch #13 is working fine. Thank you!

  • 🇮🇩Indonesia gausarts

    Hang on there, which one fixed the OP, #12 and #13? Both?

    #13, AFAIK, play/ pause button is not original library's, it is Accessible Slick's and my own custom module's, years before Accessible Slick has it.

    @mohammedodeh, if the OP is solved by #12, please move your patch into a separate issue as a Feature for inclusion under the Accessible Slick, currently still marked as a WIP due to conflicting issues, see the open ones.

    Thanks.

  • Status changed to Fixed almost 2 years ago
  • 🇮🇩Indonesia gausarts

    This issue is a mix of custom code, 1.x and 2.x with different source of problems :)

    • The custom code, the OP, had been fixed. That is why this issue is set back to Fixed, see the OP and #4.
    • Branch 1.x is no longer supported, please upgrade to 2.x.
    • For 2.x, simply update Blazy and Slick to their latest, and you will not have this issue. No patches are needed.

    Here is the combo that works without issues:

    1. Blazy <= 2.5 + Slick <= 2.6
    2. Blazy >= 2.6 + Slick >= 2.7
    3. At both cases, Slick library v1.6-1.8.0, see project home for details.
    4. Accessible Slick is still a WIP, please file the issue separately, see #15.

    Mismatch of the above combo will cause this particular issue due to core deprecation of jQuery.once which is no longer included in Slick 2.7.

    Thanks.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024