Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line 43: "detect a dollar object or create one if not found" - in some cases causes malfunctioning. #74

Open
marszalek opened this issue Jan 20, 2014 · 2 comments

Comments

@marszalek
Copy link

Imagine situation where you have a large project and don't want to allow users to use a dollar sign i.e. from the console. You just want to hide it in some of your objects.
jStorage will then fail, coz in this line (43) it is checking for existance of jQuery and if it's not, it creates it.
I think you should assume that anyone who want to use it, is fully aware of its requirements.

In this big project which I am working on right now, we are very happy for jStorage, but need to comment out this line, coz jQuery initializing for the second time causes to recreate this object only in scope of jStorage, which is wrong.

Correct me if I misunderstand sth.

@jhume
Copy link

jhume commented Feb 1, 2016

This was causing issues for me too. The CMS I work with uses an older version of jQuery. I need to load in the newer version of jQuery to meet the requirements of jStorage and I need to avoid conflicts. For reference, the code I am using is:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>

// <jStorage.js is imported here>

var jq180 = jQuery.noConflict(true);

(function($) {
  // $.jStorage.set(); and other code goes here
})(jq180);

When I comment out the line mentioned by @marszalek, everything works fine. Otherwise I get a $.jStorage undefined error.

I think this is the same problem referenced in the following issue: #90

@doublejosh
Copy link

OR you could include two versions of jQuery on the page with no-conflict mode in another namespace. It's a great way to transition between versions over a few iterations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants