summaryrefslogtreecommitdiff
path: root/modules/file/file.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/file/file.js')
-rw-r--r--modules/file/file.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/file/file.js b/modules/file/file.js
index 1071384f8..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').size() > 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,8 +118,8 @@ Drupal.file = Drupal.file || {
*/
progressBar: function (event) {
var clickedButton = this;
- var $progressId = $(clickedButton).parents('div.form-managed-file').find('input.file-progress');
- if ($progressId.size()) {
+ var $progressId = $(clickedButton).closest('div.form-managed-file').find('input.file-progress');
+ if ($progressId.length) {
var originalName = $progressId.attr('name');
// Replace the name with the required identifier.
@@ -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);
},
/**