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

Fix Dajax object visibility issue #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kami
Copy link

@Kami Kami commented Sep 17, 2013

Problem Description

Currently Dajax object is not attach to the window object. This means it won't be visible to other code (ReferenceError: Dajax is not defined) if you use a minification process which wraps all of the minified files inside a closure (function(){}())).

Most of the minification libraries, including commonly used django-pipeline do that.

Proposed solution

In my proposed solution, I've wrap Dajax object into a closure and attach it to the window object. I've also did some cleanup and changed the code to consistently use $ everywhere instead of using jQuery in some and $ in other places.

Attaching an object to window object is a fairly common thing to do if the code, like this one, is not built as a jQuery plugin.

This fixes a visibility issue which manifests itself if you have a minification
process which wraps all the files inside a closure (e.g. function(){}()). An
example of such process is using django-pipeline.
@Kami
Copy link
Author

Kami commented Sep 18, 2013

@jorgebastida Would appreciate if you can have a look. Thanks!

saz added a commit to saz/django-dajax that referenced this pull request Feb 6, 2014
@saz
Copy link

saz commented Feb 6, 2014

I've released my fork on pypi: https://pypi.python.org/pypi/django-dajax-ng

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

Successfully merging this pull request may close these issues.

2 participants