summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2012-03-28 09:33:40 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2012-03-28 09:33:40 -0700
commit966d3f310d0a39114d98ccb9623d3663478fd608 (patch)
treef3bd2c0613fd29b44fc655bba4f8c7affa6ef50d /modules
parent3643ea884ae95b2f3b760eb6842a4275c757deca (diff)
downloadbrdo-966d3f310d0a39114d98ccb9623d3663478fd608.tar.gz
brdo-966d3f310d0a39114d98ccb9623d3663478fd608.tar.bz2
Issue #1400310 by nod_, sun, m.stenta: Fixed Use of .parents() is really .closest().
Diffstat (limited to 'modules')
-rw-r--r--modules/block/block.js2
-rw-r--r--modules/field_ui/field_ui.js8
-rw-r--r--modules/file/file.js11
-rw-r--r--modules/filter/filter.js4
-rw-r--r--modules/shortcut/shortcut.admin.js2
-rw-r--r--modules/simpletest/simpletest.js2
6 files changed, 14 insertions, 15 deletions
diff --git a/modules/block/block.js b/modules/block/block.js
index e36737441..72b56733a 100644
--- a/modules/block/block.js
+++ b/modules/block/block.js
@@ -113,7 +113,7 @@ Drupal.behaviors.blockDrag = {
$('select.block-region-select', context).once('block-region-select', function () {
$(this).change(function (event) {
// Make our new row and select field.
- var row = $(this).parents('tr:first');
+ var row = $(this).closest('tr');
var select = $(this);
tableDrag.rowObject = new tableDrag.row(row);
diff --git a/modules/field_ui/field_ui.js b/modules/field_ui/field_ui.js
index 3d8881e61..1017937b6 100644
--- a/modules/field_ui/field_ui.js
+++ b/modules/field_ui/field_ui.js
@@ -28,7 +28,7 @@ Drupal.fieldUIFieldOverview = {
// 'Field type' select updates its 'Widget' select.
$('.field-type-select', table).each(function () {
- this.targetSelect = $('.widget-type-select', $(this).parents('tr').eq(0));
+ this.targetSelect = $('.widget-type-select', $(this).closest('tr'));
$(this).bind('change keyup', function () {
var selectedFieldType = this.options[this.selectedIndex].value;
@@ -43,8 +43,8 @@ Drupal.fieldUIFieldOverview = {
// 'Existing field' select updates its 'Widget' select and 'Label' textfield.
$('.field-select', table).each(function () {
- this.targetSelect = $('.widget-type-select', $(this).parents('tr').eq(0));
- this.targetTextfield = $('.label-textfield', $(this).parents('tr').eq(0));
+ this.targetSelect = $('.widget-type-select', $(this).closest('tr'));
+ this.targetTextfield = $('.label-textfield', $(this).closest('tr'));
this.targetTextfield
.data('field_ui_edited', false)
.bind('keyup', function (e) {
@@ -140,7 +140,7 @@ Drupal.fieldUIOverview = {
*/
onChange: function () {
var $trigger = $(this);
- var row = $trigger.parents('tr:first').get(0);
+ var row = $trigger.closest('tr').get(0);
var rowHandler = $(row).data('fieldUIRowHandler');
var refreshRows = {};
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);
},
/**
diff --git a/modules/filter/filter.js b/modules/filter/filter.js
index 94e01c1af..c286159fe 100644
--- a/modules/filter/filter.js
+++ b/modules/filter/filter.js
@@ -7,9 +7,9 @@ Drupal.behaviors.filterGuidelines = {
attach: function (context) {
$('.filter-guidelines', context).once('filter-guidelines')
.find(':header').hide()
- .parents('.filter-wrapper').find('select.filter-list')
+ .closest('.filter-wrapper').find('select.filter-list')
.bind('change', function () {
- $(this).parents('.filter-wrapper')
+ $(this).closest('.filter-wrapper')
.find('.filter-guidelines-item').hide()
.siblings('.filter-guidelines-' + this.value).show();
})
diff --git a/modules/shortcut/shortcut.admin.js b/modules/shortcut/shortcut.admin.js
index dfb76cb06..5554e5a7c 100644
--- a/modules/shortcut/shortcut.admin.js
+++ b/modules/shortcut/shortcut.admin.js
@@ -106,7 +106,7 @@ Drupal.behaviors.shortcutDrag = {
Drupal.behaviors.newSet = {
attach: function (context, settings) {
var selectDefault = function() {
- $($(this).parents('div.form-item').get(1)).find('> label > input').attr('checked', 'checked');
+ $(this).closest('form').find('.form-item-set .form-type-radio:last input').attr('checked', 'checked');
};
$('div.form-item-new input').focus(selectDefault).keyup(selectDefault);
}
diff --git a/modules/simpletest/simpletest.js b/modules/simpletest/simpletest.js
index 18ba73480..9cab26101 100644
--- a/modules/simpletest/simpletest.js
+++ b/modules/simpletest/simpletest.js
@@ -14,7 +14,7 @@ Drupal.behaviors.simpleTestMenuCollapse = {
// Adds group toggling functionality to arrow images.
$('div.simpletest-image').click(function () {
- var trs = $(this).parents('tbody').children('.' + settings.simpleTest[this.id].testClass);
+ var trs = $(this).closest('tbody').children('.' + settings.simpleTest[this.id].testClass);
var direction = settings.simpleTest[this.id].imageDirection;
var row = direction ? trs.length - 1 : 0;