Commit 22ef398d authored by alexpott's avatar alexpott

Issue #2154475 by tarekdj, neelam.chaudhary, droplet, nod_, lanchez,...

Issue #2154475 by tarekdj, neelam.chaudhary, droplet, nod_, lanchez, Poornima3, jamin_melville: Convert position selectors to be compatible with with jQuery native-API selector
parent 5af2cf65
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
if (this.tableSettings.hasOwnProperty(group)) { // Find the first field in this group. if (this.tableSettings.hasOwnProperty(group)) { // Find the first field in this group.
for (var d in this.tableSettings[group]) { for (var d in this.tableSettings[group]) {
if (this.tableSettings[group].hasOwnProperty(d)) { if (this.tableSettings[group].hasOwnProperty(d)) {
var field = $table.find('.' + this.tableSettings[group][d].target + ':first'); var field = $table.find('.' + this.tableSettings[group][d].target).eq(0);
if (field.length && this.tableSettings[group][d].hidden) { if (field.length && this.tableSettings[group][d].hidden) {
hidden = this.tableSettings[group][d].hidden; hidden = this.tableSettings[group][d].hidden;
cell = field.closest('td'); cell = field.closest('td');
...@@ -311,18 +311,18 @@ ...@@ -311,18 +311,18 @@
var self = this; var self = this;
var $item = $(item); var $item = $(item);
// Add a class to the title link // Add a class to the title link
$item.find('td:first a').addClass('menu-item__link'); $item.find('td').eq(0).find('a').addClass('menu-item__link');
// Create the handle. // Create the handle.
var handle = $('<a href="#" class="tabledrag-handle"><div class="handle">&nbsp;</div></a>').attr('title', Drupal.t('Drag to re-order')); var handle = $('<a href="#" class="tabledrag-handle"><div class="handle">&nbsp;</div></a>').attr('title', Drupal.t('Drag to re-order'));
// Insert the handle after indentations (if any). // Insert the handle after indentations (if any).
var $indentationLast = $item.find('td:first .js-indentation:last'); var $indentationLast = $item.find('td').eq(0).find('.js-indentation').eq(-1);
if ($indentationLast.length) { if ($indentationLast.length) {
$indentationLast.after(handle); $indentationLast.after(handle);
// Update the total width of indentation in this entire table. // Update the total width of indentation in this entire table.
self.indentCount = Math.max($item.find('.js-indentation').length, self.indentCount); self.indentCount = Math.max($item.find('.js-indentation').length, self.indentCount);
} }
else { else {
$item.find('td:first').prepend(handle); $item.find('td').eq(0).prepend(handle);
} }
if (Modernizr.touch) { if (Modernizr.touch) {
...@@ -417,7 +417,7 @@ ...@@ -417,7 +417,7 @@
break; break;
case 40: // Down arrow. case 40: // Down arrow.
case 63233: // Safari down arrow. case 63233: // Safari down arrow.
var $nextRow = $(self.rowObject.group).filter(':last').next('tr').eq(0); var $nextRow = $(self.rowObject.group).eq(-1).next('tr').eq(0);
var nextRow = $nextRow.get(0); var nextRow = $nextRow.get(0);
while (nextRow && $nextRow.is(':hidden')) { while (nextRow && $nextRow.is(':hidden')) {
$nextRow = $(nextRow).next('tr').eq(0); $nextRow = $(nextRow).next('tr').eq(0);
...@@ -436,7 +436,7 @@ ...@@ -436,7 +436,7 @@
$(nextGroup.group).each(function () { $(nextGroup.group).each(function () {
groupHeight += $(this).is(':hidden') ? 0 : this.offsetHeight; groupHeight += $(this).is(':hidden') ? 0 : this.offsetHeight;
}); });
var nextGroupRow = $(nextGroup.group).filter(':last').get(0); var nextGroupRow = $(nextGroup.group).eq(-1).get(0);
self.rowObject.swap('after', nextGroupRow); self.rowObject.swap('after', nextGroupRow);
// No need to check for indentation, 0 is the only valid one. // No need to check for indentation, 0 is the only valid one.
window.scrollBy(0, parseInt(groupHeight, 10)); window.scrollBy(0, parseInt(groupHeight, 10));
...@@ -808,7 +808,7 @@ ...@@ -808,7 +808,7 @@
// Use the first row in the table as source, because it's guaranteed to // Use the first row in the table as source, because it's guaranteed to
// be at the root level. Find the first item, then compare this row // be at the root level. Find the first item, then compare this row
// against it as a sibling. // against it as a sibling.
sourceRow = $(this.table).find('tr.draggable:first').get(0); sourceRow = $(this.table).find('tr.draggable').eq(0).get(0);
if (sourceRow === this.rowObject.element) { if (sourceRow === this.rowObject.element) {
sourceRow = $(this.rowObject.group[this.rowObject.group.length - 1]).next('tr.draggable').get(0); sourceRow = $(this.rowObject.group[this.rowObject.group.length - 1]).next('tr.draggable').get(0);
} }
...@@ -1147,7 +1147,7 @@ ...@@ -1147,7 +1147,7 @@
// Determine the valid indentations interval if not available yet. // Determine the valid indentations interval if not available yet.
if (!this.interval) { if (!this.interval) {
var prevRow = $(this.element).prev('tr').get(0); var prevRow = $(this.element).prev('tr').get(0);
var nextRow = $group.filter(':last').next('tr').get(0); var nextRow = $group.eq(-1).next('tr').get(0);
this.interval = this.validIndentInterval(prevRow, nextRow); this.interval = this.validIndentInterval(prevRow, nextRow);
} }
...@@ -1160,11 +1160,11 @@ ...@@ -1160,11 +1160,11 @@
for (var n = 1; n <= Math.abs(indentDiff); n++) { for (var n = 1; n <= Math.abs(indentDiff); n++) {
// Add or remove indentations. // Add or remove indentations.
if (indentDiff < 0) { if (indentDiff < 0) {
$group.find('.js-indentation:first').remove(); $group.find('.js-indentation').eq(0).remove();
this.indents--; this.indents--;
} }
else { else {
$group.find('td:first').prepend(Drupal.theme('tableDragIndentation')); $group.find('td').eq(0).prepend(Drupal.theme('tableDragIndentation'));
this.indents++; this.indents++;
} }
} }
...@@ -1244,7 +1244,7 @@ ...@@ -1244,7 +1244,7 @@
*/ */
Drupal.tableDrag.prototype.row.prototype.markChanged = function () { Drupal.tableDrag.prototype.row.prototype.markChanged = function () {
var marker = Drupal.theme('tableDragChangedMarker'); var marker = Drupal.theme('tableDragChangedMarker');
var cell = $(this.element).find('td:first'); var cell = $(this.element).find('td').eq(0);
if (cell.find('abbr.tabledrag-changed').length === 0) { if (cell.find('abbr.tabledrag-changed').length === 0) {
cell.append(marker); cell.append(marker);
} }
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
var $header = $(this); var $header = $(this);
var position = $header.prevAll('th').length; var position = $header.prevAll('th').length;
self.$table.find('tbody tr').each(function () { self.$table.find('tbody tr').each(function () {
var $cells = $(this).find('td:eq(' + position + ')'); var $cells = $(this).find('td').eq(position);
$cells.show(); $cells.show();
// Keep track of the revealed cells, so they can be hidden later. // Keep track of the revealed cells, so they can be hidden later.
self.$revealedCells = $().add(self.$revealedCells).add($cells); self.$revealedCells = $().add(self.$revealedCells).add($cells);
......
...@@ -55,8 +55,8 @@ ...@@ -55,8 +55,8 @@
} }
}); });
$(tab_list).find('> li:first').addClass('first'); $(tab_list).find('> li').eq(0).addClass('first');
$(tab_list).find('> li:last').addClass('last'); $(tab_list).find('> li').eq(-1).addClass('last');
if (!tab_focus) { if (!tab_focus) {
// If the current URL has a fragment and one of the tabs contains an // If the current URL has a fragment and one of the tabs contains an
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
tab_focus = $locationHash.closest('.vertical-tabs__pane'); tab_focus = $locationHash.closest('.vertical-tabs__pane');
} }
else { else {
tab_focus = $this.find('> .vertical-tabs__pane:first'); tab_focus = $this.find('> .vertical-tabs__pane').eq(0);
} }
} }
if (tab_focus.length) { if (tab_focus.length) {
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
if (event.keyCode === 13) { if (event.keyCode === 13) {
self.focus(); self.focus();
// Set focus on the first input field of the visible details/tab pane. // Set focus on the first input field of the visible details/tab pane.
$(".vertical-tabs__pane :input:visible:enabled:first").trigger('focus'); $(".vertical-tabs__pane :input:visible:enabled").eq(0).trigger('focus');
} }
}); });
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
// actual DOM element order as jQuery implements sortOrder, but not as public // actual DOM element order as jQuery implements sortOrder, but not as public
// method. // method.
this.item.parent().children('.vertical-tabs__menu-item').removeClass('first') this.item.parent().children('.vertical-tabs__menu-item').removeClass('first')
.filter(':visible:first').addClass('first'); .filter(':visible').eq(0).addClass('first');
// Display the details element. // Display the details element.
this.details.removeClass('vertical-tab--hidden').show(); this.details.removeClass('vertical-tab--hidden').show();
// Focus this tab. // Focus this tab.
...@@ -172,11 +172,11 @@ ...@@ -172,11 +172,11 @@
// actual DOM element order as jQuery implements sortOrder, but not as public // actual DOM element order as jQuery implements sortOrder, but not as public
// method. // method.
this.item.parent().children('.vertical-tabs__menu-item').removeClass('first') this.item.parent().children('.vertical-tabs__menu-item').removeClass('first')
.filter(':visible:first').addClass('first'); .filter(':visible').eq(0).addClass('first');
// Hide the details element. // Hide the details element.
this.details.addClass('vertical-tab--hidden').hide(); this.details.addClass('vertical-tab--hidden').hide();
// Focus the first visible tab (if there is one). // Focus the first visible tab (if there is one).
var $firstTab = this.details.siblings('.vertical-tabs__pane:not(.vertical-tab--hidden):first'); var $firstTab = this.details.siblings('.vertical-tabs__pane:not(.vertical-tab--hidden)').eq(0);
if ($firstTab.length) { if ($firstTab.length) {
$firstTab.data('verticalTab').focus(); $firstTab.data('verticalTab').focus();
} }
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
tableDrag.rowObject = new tableDrag.row(row); tableDrag.rowObject = new tableDrag.row(row);
// Find the correct region and insert the row as the last in the region. // Find the correct region and insert the row as the last in the region.
table.find('.region-' + select[0].value + '-message').nextUntil('.region-message').last().before(row); table.find('.region-' + select[0].value + '-message').nextUntil('.region-message').eq(-1).before(row);
// Modify empty regions with added or removed fields. // Modify empty regions with added or removed fields.
checkEmptyRegions(table, row); checkEmptyRegions(table, row);
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
// Create a model and the appropriate views. // Create a model and the appropriate views.
var model = new contextual.StateModel({ var model = new contextual.StateModel({
title: $region.find('h2:first').text().trim() title: $region.find('h2').eq(0).text().trim()
}); });
var viewOptions = $.extend({el: $contextual, model: model}, options); var viewOptions = $.extend({el: $contextual, model: model}, options);
contextual.views.push({ contextual.views.push({
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
// Store the actual value of this field. We'll need this to restore the // Store the actual value of this field. We'll need this to restore the
// original value when the user discards his modifications. // original value when the user discards his modifications.
this.$textElement = this.$el.find('.field-item:first'); this.$textElement = this.$el.find('.field-item').eq(0);
this.model.set('originalValue', this.$textElement.html()); this.model.set('originalValue', this.$textElement.html());
}, },
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
var $widget = $(this).closest('.text-format-wrapper'); var $widget = $(this).closest('.text-format-wrapper');
var $summary = $widget.find('.text-summary-wrapper'); var $summary = $widget.find('.text-summary-wrapper');
var $summaryLabel = $summary.find('label').first(); var $summaryLabel = $summary.find('label').eq(0);
var $full = $widget.find('.text-full').closest('.form-item'); var $full = $widget.find('.text-full').closest('.form-item');
var $fullLabel = $full.find('label').first(); var $fullLabel = $full.find('label').eq(0);
// Create a placeholder label when the field cardinality is greater // Create a placeholder label when the field cardinality is greater
// than 1. // than 1.
......
...@@ -206,7 +206,7 @@ ...@@ -206,7 +206,7 @@
$(this).find('.tour-progress').text(progress); $(this).find('.tour-progress').text(progress);
}) })
// Update the last item to have "End tour" as the button. // Update the last item to have "End tour" as the button.
.last() .eq(-1)
.attr('data-text', Drupal.t('End tour')); .attr('data-text', Drupal.t('End tour'));
} }
} }
......
...@@ -241,7 +241,7 @@ ...@@ -241,7 +241,7 @@
var $addDisplayDropdown = $('<li class="add"><a href="#"><span class="icon add"></span>' + Drupal.t('Add') + '</a><ul class="action-list" style="display:none;"></ul></li>'); var $addDisplayDropdown = $('<li class="add"><a href="#"><span class="icon add"></span>' + Drupal.t('Add') + '</a><ul class="action-list" style="display:none;"></ul></li>');
var $displayButtons = $menu.nextAll('input.add-display').detach(); var $displayButtons = $menu.nextAll('input.add-display').detach();
$displayButtons.appendTo($addDisplayDropdown.find('.action-list')).wrap('<li>') $displayButtons.appendTo($addDisplayDropdown.find('.action-list')).wrap('<li>')
.parent().first().addClass('first').end().last().addClass('last'); .parent().eq(0).addClass('first').end().eq(-1).addClass('last');
// Remove the 'Add ' prefix from the button labels since they're being palced // Remove the 'Add ' prefix from the button labels since they're being palced
// in an 'Add' dropdown. // in an 'Add' dropdown.
// @todo This assumes English, but so does $addDisplayDropdown above. Add // @todo This assumes English, but so does $addDisplayDropdown above. Add
...@@ -701,7 +701,7 @@ ...@@ -701,7 +701,7 @@
// Within the row, the operator labels are displayed inside the first table // Within the row, the operator labels are displayed inside the first table
// cell (next to the filter name). // cell (next to the filter name).
var $draggableRow = $(this.draggableRows[i]); var $draggableRow = $(this.draggableRows[i]);
var $firstCell = $draggableRow.find('td:first'); var $firstCell = $draggableRow.find('td').eq(0);
if ($firstCell.length) { if ($firstCell.length) {
// The value of the operator label ("And" or "Or") is taken from the // The value of the operator label ("And" or "Or") is taken from the
// first operator dropdown we encounter, going backwards from the current // first operator dropdown we encounter, going backwards from the current
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment