Uncaught TypeError: Cannot read property 'parentNode' of undefined #1429

Closed
josefloreschura opened this Issue Jun 23, 2015 · 3 comments

Projects

None yet

2 participants

@josefloreschura

This happens only when hideScaled is enabled and I call to the method cancelAll when some of the scaled images is uploading. It does not happen if all the scaled images were uploaded sucessfully and the parent image is still uploading

    scaling: {
            hideScaled: true,
    },

Checking the code, it seems that it's because cancelAll tries to remove the dom element of the scaled image, BUT when hideScaled is enabled this dom element does not exist

Fine Uploader Version: 5.1.3
Code throwing the error: s3.jquery.fine-uploader.js:79
remove: function() {
element.parentNode.removeChild(element);
return this;
},
Stacktrace: Uncaught TypeError: Cannot read property 'parentNode' of undefinedremove @ s3.jquery.fine-uploader.js:79
qq.extend.removeFile @ s3.jquery.fine-uploader.js:7250
qq.uiPrivateApi._removeFileItem @ s3.jquery.fine-uploader.js:5795
qq.uiPrivateApi._onCancel @ s3.jquery.fine-uploader.js:6119
(anonymous function) @ s3.jquery.fine-uploader.js:2266
(anonymous function) @ s3.jquery.fine-uploader.js:1109
qq.each @ s3.jquery.fine-uploader.js:659
qq.extend.success @ s3.jquery.fine-uploader.js:1108
(anonymous function) @ s3.jquery.fine-uploader.js:4086
qq.extend.then @ s3.jquery.fine-uploader.js:1086
qq.extend.cancel @ s3.jquery.fine-uploader.js:4081
qq.extend.cancel @ s3.jquery.fine-uploader.js:4728
qq.extend.cancelAll @ s3.jquery.fine-uploader.js:4751
qq.basePublicApi.cancelAll @ s3.jquery.fine-uploader.js:1678
delegateCommand @ s3.jquery.fine-uploader.js:14493
(anonymous function) @ s3.jquery.fine-uploader.js:14520
m.extend.each @ jquery.min.js:2
m.fn.m.each @ jquery.min.js:2
$.fn.fineUploader @ s3.jquery.fine-uploader.js:14516
$.fn.fineUploaderS3 @ s3.jquery.fine-uploader.js:14564

@rnicholus
Member

I ran into #1431 (a regression likely caused by work on 5.2.0) when trying to reproduce this. So, once I fix that, I'll look closer and try to ensure this is also fixed in 5.2.3.

@rnicholus rnicholus added this to the 5.2.3 milestone Jun 23, 2015
@rnicholus rnicholus modified the milestone: 5.2.3, 5.3.0 Jul 6, 2015
@rnicholus
Member

@josefloreschura This should be fixed as a result of my work on #1431. Instead of not adding "hidden" scaled files elements to the DOM, the corresponding elements are now added as of 5.3.0-6, but they are hidden and annotated so that Fine Uploader will never make them visible or return a reference to them via the public API.

Please confirm that this fixes your issue. I'm currently staging 5.3.0-6 on the develop branch. You can access the jQuery S3 version at http://releases.fineuploader.com/develop/5.3.0-6/s3.jquery.fine-uploader-5.3.0-6.zip.

@josefloreschura

Hi @rnicholus. just tested this and worked!
Error in dev console is no longer displayed and the scaled image was cancelled properly.
Thanks!

@rnicholus rnicholus closed this Aug 3, 2015
@rnicholus rnicholus removed the 5 - Done label Aug 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment