Problem/Motivation
There appears to be a long standing issue with the 2.52 version of jquery form that we are using that may be impacting the ability to upload files for Opera users. One runs into this issue while testing #1328900: Update to jQuery 1.7. Tests from JavaScript Tests | groups.drupal.org that don't work:
Uploading files: error here actually in jquery.form.js. Here's how to reproduce the uploaded error:
- With a fresh install created an article or a page.
- Try to upload a file.
- Notice that the throbber continues to rotate and the upload process never completes.
Also notice the following error is logged. The error is in /core/misc/jquery.form.js?v=2.52 line 12:
Uncaught TypeError: Object function ( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
} has no method 'handleError'
Here are some other issue queues where the problem has been reported:
- http://bugs.jquery.com/ticket/8045 might be related.
- https://github.com/malsup/form/issues/56
The issue reported above has been resolved since version 2.60 of jQuery Form. Their development team is currently on version 2.87.
Proposed resolution
Since we are in the process of updating javascript libraries with our move to jQuery 1.7, this is a great opportunity to update all of our javascript libraries. Starting with jQuery Form. Also see this, this update is important for the html5 initiative:
https://github.com/malsup/form/issues/100
Attached is a patch that updates to the latest update of git version of js.
Remaining tasks
Perhaps things will break if we adopted the latest/greatest version of this library. Great! We could then write the necessary javascript-based unit tests to test all of the interactions of this library with Drupal and reuse those unit tests for future development.
User interface changes
???
API changes
???
Original report by cosmicdreams
The original issue's summary is (mostly) copy-pasted from the now closed as duplicate #1338402: Update jQuery Form.
Comment | File | Size | Author |
---|---|---|---|
#9 | 1203532-9.patch | 37.5 KB | ericduran |
jquery.form_.patch | 34.92 KB | keichee | |
Comments
Comment #1
tim.plunkettComment #2
marcingy CreditAttribution: marcingy commentedThis a task. And it should be minified.
Comment #3
rfayComment #4
andypostMarked as duplicate #1338402: Update jQuery Form
Also it has great summary
Comment #5
klonosGreat summary indeed. That's why I copy-pasted it here ;)
Please take a look at it and correct where/as needed. Credits go to Chris Weber (cosmicdreams)
PS (off-topic): on issue summary preview the uploaded patch shows green as expected for a patch that passes tests. On plain display though it shows white - not indicating status on first look. Is this a known css issue of summaries on d.o.??
Comment #6
cosmicdreams CreditAttribution: cosmicdreams commentedCool, thanks for the shout out gang!
I've tried to contact @malsup on Twitter to get his insight on what changes we should call out in the UI changes and API changes sections.
Comment #7
ericduran CreditAttribution: ericduran commentedThis is still missing work.
The system_library function needs to be updated to include the new version number.
Also the last version was minified this one isn't. I think is fine to have it unminified for now, but we probably should mention that we're doing that on purpose if we are. and create a seperate task to minified it before release D8.
Comment #8
catchAfter #1328900: Update to jQuery 1.7 having these out of sync is a regression, bumping to critical.
Comment #9
ericduran CreditAttribution: ericduran commentedSimple enough.
I lets the jquery.form.js unminified but I do think we'll eventually want to minified it.
Comment #10
catchRe-titling since I think we're just upgrading to latest point releases at the moment. Thanks for the quick patching!
Comment #11
cosmicdreams CreditAttribution: cosmicdreams commentedpatch reported the following warnings:
Comment #12
ericduran CreditAttribution: ericduran commentedYea, thats from the actual Jquery Form plugin. Not really sure if we should minified it ourself or not.
Comment #13
catchI opened #1341792: [meta] Ship minified versions of external JavaScript libraries for minification of jquery.js et al. If there's no provided minified version I'm not opposed to minifying ourselves but that probably needs its own issue to discuss.
Could we open an upstream bug report for the whitespace errors maybe? Not sure how that works with jQuery plugins though.
Comment #14
cosmicdreams CreditAttribution: cosmicdreams commentedTesting this now. Will take special interesting in whether this fixes file uploading
With this patch applied the main issue I was hoping it would resolve still persists:
as a content creator, I want to upload files to a node. Instead, this error occurs.
from line 12 of jquery.form.js
Can someone verify if the issues I'm having are specific to my environment or if they are wide-spread.
Comment #15
ericduran CreditAttribution: ericduran commented@cosmicdreams hmm, I'll test that. Is this with any file upload?
Is this new since the introduction on 1.7?
Comment #16
cosmicdreams CreditAttribution: cosmicdreams commentedYes it's with any file upload, I can only assume that it is an issue I am having since 1.7 since I can upload files with Drupal 7. But it might also be related to my development environment.
I'm using Ubuntu (latest) + SQLite as a backend database.
Comment #17
ericduran CreditAttribution: ericduran commentedI just tested this.
Ajax file upload is indeed currently broken in D8.
But after applying this patch, clearing my cache and testing again. Everything is now fixed.
I'll love for someone else to confirm so we can get this in.
Edit: I also submitted a patch to the jquery.form project (https://github.com/malsup/form/pull/151), so we can use their minified version instead and then we don't have to worry about all the line ending issues.
Comment #18
cosmicdreams CreditAttribution: cosmicdreams commentedCool, i'll reproduce your steps and see if i have a different result.
EDIT: OK, yes, that works. Man do I feel silly for forgetting to flush cache on testing a revised javascript.
Recommend RTBC
Comment #19
cosmicdreams CreditAttribution: cosmicdreams commentedComment #20
catchOne advantage of having the minified versions in core is you don't have to look at the tabs, nothing we can do about that though and it makes sense to have unminified versions for debugging during this point in the cycle.
Committed/pushed to 8.x, thanks!
Comment #21
cosmicdreams CreditAttribution: cosmicdreams commentedAwesome catch! Woohoo!
Comment #22.0
(not verified) CreditAttribution: commented...(mostly) copy-pasting the summary from the now closed as duplicate #1338402: Update jQuery Form + conforming to the issue summary standards (http://drupal.org/node/1155816). Credits go to cosmicdreams.