From 9737048607fc6d999d50b6231773af80d74564bc Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Tue, 6 Mar 2012 16:55:29 +0900 Subject: [PATCH] Accept a selector string or DOM element as filesContainer option. --- js/jquery.fileupload-ui.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/js/jquery.fileupload-ui.js b/js/jquery.fileupload-ui.js index 8cef5a04f..43a65dc89 100644 --- a/js/jquery.fileupload-ui.js +++ b/js/jquery.fileupload-ui.js @@ -1,5 +1,5 @@ /* - * jQuery File Upload User Interface Plugin 6.6 + * jQuery File Upload User Interface Plugin 6.6.1 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2010, Sebastian Tschan @@ -573,24 +573,31 @@ options.filesContainer.prop('nodeName') ); if (tmpl) { - options.uploadTemplate = tmpl(options.uploadTemplateId); - options.downloadTemplate = tmpl(options.downloadTemplateId); + if (options.uploadTemplateId) { + options.uploadTemplate = tmpl(options.uploadTemplateId); + } + if (options.downloadTemplateId) { + options.downloadTemplate = tmpl(options.downloadTemplateId); + } } }, _initFilesContainer: function () { - if (!this.options.filesContainer) { - this.options.filesContainer = this.element.find('.files'); + var options = this.options; + if (options.filesContainer === undefined) { + options.filesContainer = this.element.find('.files'); + } else if (!(options.filesContainer instanceof $)) { + options.filesContainer = $(options.filesContainer); } }, _initSpecialOptions: function () { parentWidget.prototype._initSpecialOptions.call(this); + this._initFilesContainer(); this._initTemplates(); }, _create: function () { - this._initFilesContainer(); parentWidget.prototype._create.call(this); this._refreshOptionsList.push( 'filesContainer',