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

don't use eval in this way #72

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

Conversation

db48x
Copy link

@db48x db48x commented Jan 17, 2014

It calls eval on a string containing a variable name; when the minification happens and the variable is renamed, the result is a runtime error.

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

saz commented Feb 6, 2014

Your change results in the following error message:

Uncaught TypeError: Property '$("#id_date").val' of object [object global] is not a function 

The json received from the server:

[{"fun": "$(\"#id_date\").val", "cmd": "data", "val": "2014-04-08"}]

I've reverted this change in my fork.

@db48x
Copy link
Author

db48x commented Feb 13, 2014

I hear ya. Perhaps there should be something along the lines of [{"cmd": "method", "elem": "#id_date", fun: "val", "val": "2014-04-08"}], but that's not for me to say. In any case, you could just use [{"cmd": "js", "val": "$("#id_date").val("2014-04-08")"}], although I agree it's not as nice.

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