diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2012-03-28 09:33:40 -0700 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2012-03-28 09:33:40 -0700 |
commit | 966d3f310d0a39114d98ccb9623d3663478fd608 (patch) | |
tree | f3bd2c0613fd29b44fc655bba4f8c7affa6ef50d /misc | |
parent | 3643ea884ae95b2f3b760eb6842a4275c757deca (diff) | |
download | brdo-966d3f310d0a39114d98ccb9623d3663478fd608.tar.gz brdo-966d3f310d0a39114d98ccb9623d3663478fd608.tar.bz2 |
Issue #1400310 by nod_, sun, m.stenta: Fixed Use of .parents() is really .closest().
Diffstat (limited to 'misc')
-rw-r--r-- | misc/machine-name.js | 2 | ||||
-rw-r--r-- | misc/tabledrag.js | 6 | ||||
-rw-r--r-- | misc/tableselect.js | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/misc/machine-name.js b/misc/machine-name.js index 66eb9d472..ced8c4bee 100644 --- a/misc/machine-name.js +++ b/misc/machine-name.js @@ -30,7 +30,7 @@ Drupal.behaviors.machineName = { var $source = $(source_id, context).addClass('machine-name-source'); var $target = $(options.target, context).addClass('machine-name-target'); var $suffix = $(options.suffix, context); - var $wrapper = $target.parents('.form-item:first'); + var $wrapper = $target.closest('.form-item'); // All elements have to exist. if (!$source.length || !$target.length || !$suffix.length || !$wrapper.length) { return; diff --git a/misc/tabledrag.js b/misc/tabledrag.js index 4d4edfbd0..437b08c0f 100644 --- a/misc/tabledrag.js +++ b/misc/tabledrag.js @@ -125,7 +125,7 @@ Drupal.tableDrag.prototype.initColumns = function () { var field = $('.' + this.tableSettings[group][d].target + ':first', this.table); if (field.length && this.tableSettings[group][d].hidden) { var hidden = this.tableSettings[group][d].hidden; - var cell = field.parents('td:first'); + var cell = field.closest('td'); break; } } @@ -754,7 +754,7 @@ Drupal.tableDrag.prototype.updateField = function (changedRow, group) { switch (rowSettings.action) { case 'depth': // Get the depth of the target row. - targetElement.value = $('.indentation', $(sourceElement).parents('tr:first')).length; + targetElement.value = $('.indentation', $(sourceElement).closest('tr')).length; break; case 'match': // Update the value. @@ -886,7 +886,7 @@ Drupal.tableDrag.prototype.row = function (tableRow, method, indentEnabled, maxD this.group = [tableRow]; this.groupDepth = $('.indentation', tableRow).length; this.changed = false; - this.table = $(tableRow).parents('table:first').get(0); + this.table = $(tableRow).closest('table').get(0); this.indentEnabled = indentEnabled; this.maxDepth = maxDepth; this.direction = ''; // Direction the row is being moved. diff --git a/misc/tableselect.js b/misc/tableselect.js index 60b492197..5a88ac20c 100644 --- a/misc/tableselect.js +++ b/misc/tableselect.js @@ -30,7 +30,7 @@ Drupal.tableSelect = function () { checkboxes.each(function () { this.checked = event.target.checked; // Either add or remove the selected class based on the state of the check all checkbox. - $(this).parents('tr:first')[ this.checked ? 'addClass' : 'removeClass' ]('selected'); + $(this).closest('tr').toggleClass('selected', this.checked); }); // Update the title and the state of the check all box. updateSelectAll(event.target.checked); @@ -40,14 +40,14 @@ Drupal.tableSelect = function () { // For each of the checkboxes within the table that are not disabled. checkboxes = $('td input:checkbox:enabled', table).click(function (e) { // Either add or remove the selected class based on the state of the check all checkbox. - $(this).parents('tr:first')[ this.checked ? 'addClass' : 'removeClass' ]('selected'); + $(this).closest('tr').toggleClass('selected', this.checked); // If this is a shift click, we need to highlight everything in the range. // Also make sure that we are actually checking checkboxes over a range and // that a checkbox has been checked or unchecked before. if (e.shiftKey && lastChecked && lastChecked != e.target) { // We use the checkbox's parent TR to do our range searching. - Drupal.tableSelectRange($(e.target).parents('tr')[0], $(lastChecked).parents('tr')[0], e.target.checked); + Drupal.tableSelectRange($(e.target).closest('tr')[0], $(lastChecked).closest('tr')[0], e.target.checked); } // If all checkboxes are checked, make sure the select-all one is checked too, otherwise keep unchecked. |