• This applies to “Snow Storm” version 1.4.2.

    The plug-in’s JavaScript depends on jQuery. For that reason, it should be enqueued with the dependency specified, but in version 1.4.2 it’s not.

    The result is that the JavaScript does not execute properly, if at all. Using Internet Explorer, for example, can lead to a script error dialogue.

    #### Steps to reproduce:

    1. Use a theme that does not use jQuery.
    2. Install and activate “Snow Storm”.
    3. Load a page.
    4. Examine the page source code.

    #### Expected behaviour:

    • The snow effect to render.
    • The jquery.js script to be loaded before snow-storm.js and before the in-line script generated by views/default/head.php is emitted.

    #### Actual behaviour:

    • A script error dialogue (when using IE), saying “jQuery is undefined”.
    • No snow effects.
    • The jquery.js script is not loaded.

    #### Impact

    For many themes, this will not be an issue as they will probably use jQuery already, thereby hiding the problem. For some, however, specifically in cases where jQuery is not loaded, the plug-in will not work.

    #### Suggested solution:

    The JavaScript is enqueued in snow_storm_enqueue_scripts() at line 92 onwards, snow-storm.php:

    wp_enqueue_script('snow-storm', plugins_url() . DS . 'snow-storm' . DS . 'snow-storm.js', false, '1.41');

    I suggest replacing this with:

    wp_enqueue_script('snow-storm', plugins_url() . '/snow-storm/snow-storm.js', array('jquery'), '1.41');

    I’ve made similar changes to my copy of “Snow Storm” and it seems to work okay. It would be nice if this could be fixed in subsequent versions, thereby avoiding the need to do this.

  • The topic ‘Missing jQuery Dependency’ is closed to new replies.