diff options
Diffstat (limited to 'modules/file')
-rw-r--r-- | modules/file/file.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/modules/file/file.js b/modules/file/file.js index 827374c0f..1a9f87e4f 100644 --- a/modules/file/file.js +++ b/modules/file/file.js @@ -1,4 +1,3 @@ - /** * @file * Provides JavaScript additions to the managed file field type. @@ -77,7 +76,7 @@ Drupal.file = Drupal.file || { '%filename': this.value, '%extensions': extensionPattern.replace(/\|/g, ', ') }); - $(this).parents('div.form-managed-file').prepend('<div class="messages error file-upload-js-error">' + error + '</div>'); + $(this).closest('div.form-managed-file').prepend('<div class="messages error file-upload-js-error">' + error + '</div>'); this.value = ''; return false; } @@ -96,8 +95,8 @@ Drupal.file = Drupal.file || { // Check if we're working with an "Upload" button. var $enabledFields = []; - if ($(this).parents('div.form-managed-file').length > 0) { - $enabledFields = $(this).parents('div.form-managed-file').find('input.form-file'); + if ($(this).closest('div.form-managed-file').length > 0) { + $enabledFields = $(this).closest('div.form-managed-file').find('input.form-file'); } // Temporarily disable upload fields other than the one we're currently @@ -119,7 +118,7 @@ Drupal.file = Drupal.file || { */ progressBar: function (event) { var clickedButton = this; - var $progressId = $(clickedButton).parents('div.form-managed-file').find('input.file-progress'); + var $progressId = $(clickedButton).closest('div.form-managed-file').find('input.file-progress'); if ($progressId.length) { var originalName = $progressId.attr('name'); @@ -133,7 +132,7 @@ Drupal.file = Drupal.file || { } // Show the progress bar if the upload takes longer than half a second. setTimeout(function () { - $(clickedButton).parents('div.form-managed-file').find('div.ajax-progress-bar').slideDown(); + $(clickedButton).closest('div.form-managed-file').find('div.ajax-progress-bar').slideDown(); }, 500); }, /** |