Closed kmike closed 13 years ago
Great fixes, thanks kmike. Everything looks great but i'd like to have more details on the widget creation issues: DOMContentLoaded (aka jQuery.ready) should work just fine. Do you mind providing details? Maybe i can help tackling the issue.
I'm using this widget in django admin (with django-admin-tools installed) and sometimes it fails with this error: https://skitch.com/mikekorobovmike/fa6g5/line . Reloading page does help.
Hmm I use django-admin-tools also. I think it might have something to do with the two version of jQuery (contrib.admin and django-admin-tools) living together in the admin.
I see that django-admin tools loads a second version of jQuery asynchronously and we might fall in a race condition because of the (jQuery || django.jQuery).
What happens if you replace: (jQuery || django.jQuery) by (django.jQuery || jQuery) at https://github.com/charettes/django-colorful/blob/master/colorful/widgets.py#L32 ?
I think it might fix the issue.
2011/9/10 Mikhail Korobov < reply@reply.github.com>
I'm using this widget in django admin (with django-admin-tools installed) and sometimes it fails with this error: https://skitch.com/mikekorobovmike/fa6g5/line . Reloading page does help.
Reply to this email directly or view it on GitHub: https://github.com/charettes/django-colorful/pull/3#issuecomment-2058851
What happens if you replace (jQuery || django.jQuery)
in widgets.py by (django.jQuery || jQuery)
?
I think it should fix the issue.
Yes, this fix seems correct, I'm not able to reproduce the issue with (django.jQuery || jQuery)
. I'm not sure it will work if there is no 'django.jQuery' (e.g. in public site) and won't blow up with an exception in IE though.
You're right about the IE part. Let's do it 'django' in window ? django.jQuery : jQuery
.
Do you mind committing the changes in this branch while back using $(document).ready
?
This way i could just pull your request with everything at the same time.
Done!
Just noticed that js error occurs less often but is not properly fixed.