How to save jQuery object in a cookie?

Why is the jQuery object constructed as a local copy inside a Module pattern inside a self-executing function?

  • This is true for at least for 1.4 and 1.5. Paul Irish explains how it works here: but he doesnt explain why. What are the benefits of this pretty complicated object construction? What options are there?

  • Answer:

    Originally, jQuery was defined as a traditional function expression that returned an instance of the jQuery.fn.init() constructor. As the library and it's requirements grew and code base demanded further compartmentalization and privatization of logic the Module Pattern function expression was added to wrap up this logic and allow a clean return of the jQuery() function.

Rick Waldron at Quora Visit the source

Was this solution helpful to you?

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.