Skip to content

Possible portability issue #71

@asiby

Description

@asiby

Hello there

I have noticed something that rubs me the wrong way in jquery.meanmenu.js

The code in that file is wrapped in a IIFE like so ...

(function ($) {
  // Bunch of code
})(jQuery);

However, inside the code of the plugin, there is not a single place where the $ variable is being used when performing jQuery searches.

For instance, when initializing the defaults, it is done like this ...

var defaults = {
    meanMenuTarget: jQuery(this),
    // etc.
};

Instead, a better way of doing this would be ...

var defaults = {
  meanMenuTarget: $(this),
  // etc.
};

I believe that using the $ will avoid issues when more than one version of jQuery are being used in the same page ... in which case, $ will refer to the actual jQuery being used to initialize meanmenu instead of the global/default jQuery, which might not be compatible with meanmenu.

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions