Skip to content

Commit ff8c035

Browse files
committed
Handle cases where the templates are defined after the widget library has been included.
1 parent 5838087 commit ff8c035

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

jquery.fileupload-ui.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload User Interface Plugin 5.0.4
2+
* jQuery File Upload User Interface Plugin 5.0.5
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2010, Sebastian Tschan
@@ -531,8 +531,26 @@
531531
});
532532
},
533533

534+
_initTemplates: function () {
535+
// Handle cases where the templates are defined
536+
// after the widget library has been included:
537+
if (this.options.uploadTemplate instanceof $ &&
538+
!this.options.uploadTemplate.length) {
539+
this.options.uploadTemplate = $(
540+
this.options.uploadTemplate.selector
541+
);
542+
}
543+
if (this.options.downloadTemplate instanceof $ &&
544+
!this.options.downloadTemplate.length) {
545+
this.options.downloadTemplate = $(
546+
this.options.downloadTemplate.selector
547+
);
548+
}
549+
},
550+
534551
_create: function () {
535552
$.blueimp.fileupload.prototype._create.call(this);
553+
this._initTemplates();
536554
this.element
537555
.addClass('ui-widget');
538556
this._initFileUploadButtonBar();

0 commit comments

Comments
 (0)