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

Avoid jQuery conflicts #345

Open
sehmaschine opened this issue Jul 18, 2013 · 3 comments
Open

Avoid jQuery conflicts #345

sehmaschine opened this issue Jul 18, 2013 · 3 comments

Comments

@sehmaschine
Copy link

see http://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/

Not sure what's the best way to achieve this – django uses:

(function($) {
})(django.jQuery);
@gregmuellegger
Copy link
Contributor

To be honest, the django approach always bugged me. I always wanted to have a jquery in the admin anyway. And I think it's nonsense to include two different versions (one for your own plugins and the django.jQuery one for the django stuff). I think we should always include the latest jquery version without any noConflict calls.

If a user needs his own jQuery, then he can use the noConflict himself.

The only problem I see is that custom widgets might define jquery as dependency in their class Media: listing. If that one gets included, it will break the already included jquery from admin2. But that problem isn't solved by using noConflict for the admin itself. Because if you then have two different widgets with each importing jquery .... you see the big picture.

I want a JS dependency resolving in django anyway. Isn't their a good app for this anywhere?

@sehmaschine
Copy link
Author

Theoretically speaking I do agree, but ... when using 3rd–party admin–based apps, you probably cannot assume they use noConflict. Besides, if an admin–app uses django.jQuery it's pretty clear what they refer to.

@douglasmiranda
Copy link
Contributor

I'd agree with @gregmuellegger, but @sehmaschine has a point when saying that we cannot assume they use noConflict.

I've researched a lot about this. And looks like, still, the best way to do this is:

(function($) {
    //...
})(django.jQuery);

Maybe we should to encourage the developers to use noConflict from now on. So, in the future, the reality doesn't sucks.

@auvipy auvipy added this to the 0.8.0 - Theme improvement milestone Nov 13, 2016
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

4 participants