Permalink
Browse files

Prevent multiple calls to enable/disable the plugin - Fixes #620.

  • Loading branch information...
1 parent 9dde2e8 commit 3c5d440fcdd51bc04e4edd68eec70efb4cc517a0 @blueimp committed Sep 6, 2012
Showing with 24 additions and 8 deletions.
  1. +13 −5 js/jquery.fileupload-ui.js
  2. +11 −3 js/jquery.fileupload.js
View
@@ -1,5 +1,5 @@
/*
- * jQuery File Upload User Interface Plugin 6.9.4
+ * jQuery File Upload User Interface Plugin 6.9.5
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
@@ -720,14 +720,22 @@
},
enable: function () {
+ var wasDisabled = false;
+ if (this.options.disabled) {
+ wasDisabled = true;
+ }
parentWidget.prototype.enable.call(this);
- this.element.find('input, button').prop('disabled', false);
- this._enableFileInputButton();
+ if (wasDisabled) {
+ this.element.find('input, button').prop('disabled', false);
+ this._enableFileInputButton();
+ }
},
disable: function () {
- this.element.find('input, button').prop('disabled', true);
- this._disableFileInputButton();
+ if (!this.options.disabled) {
+ this.element.find('input, button').prop('disabled', true);
+ this._disableFileInputButton();
+ }
parentWidget.prototype.disable.call(this);
}
View
@@ -1,5 +1,5 @@
/*
- * jQuery File Upload Plugin 5.16.3
+ * jQuery File Upload Plugin 5.16.4
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
@@ -991,12 +991,20 @@
},
enable: function () {
+ var wasDisabled = false;
+ if (this.options.disabled) {
+ wasDisabled = true;
+ }
$.Widget.prototype.enable.call(this);
- this._initEventHandlers();
+ if (wasDisabled) {
+ this._initEventHandlers();
+ }
},
disable: function () {
- this._destroyEventHandlers();
+ if (!this.options.disabled) {
+ this._destroyEventHandlers();
+ }
$.Widget.prototype.disable.call(this);
},

0 comments on commit 3c5d440

Please sign in to comment.