- Patch #1346914 by droplet: use .length instead of jQuery.size().
parent
768affe5fd
commit
1c09cbb5c4
|
@ -32,7 +32,7 @@ Drupal.behaviors.autocomplete = {
|
||||||
Drupal.autocompleteSubmit = function () {
|
Drupal.autocompleteSubmit = function () {
|
||||||
return $('#autocomplete').each(function () {
|
return $('#autocomplete').each(function () {
|
||||||
this.owner.hidePopup();
|
this.owner.hidePopup();
|
||||||
}).size() == 0;
|
}).length == 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -123,7 +123,7 @@ Drupal.jsAC.prototype.selectDown = function () {
|
||||||
}
|
}
|
||||||
else if (this.popup) {
|
else if (this.popup) {
|
||||||
var lis = $('li', this.popup);
|
var lis = $('li', this.popup);
|
||||||
if (lis.size() > 0) {
|
if (lis.length > 0) {
|
||||||
this.highlight(lis.get(0));
|
this.highlight(lis.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ Drupal.jsAC.prototype.found = function (matches) {
|
||||||
|
|
||||||
// Show popup with matches, if any.
|
// Show popup with matches, if any.
|
||||||
if (this.popup) {
|
if (this.popup) {
|
||||||
if (ul.children().size()) {
|
if (ul.children().length) {
|
||||||
$(this.popup).empty().append(ul).show();
|
$(this.popup).empty().append(ul).show();
|
||||||
$(this.ariaLive).html(Drupal.t('Autocomplete popup'));
|
$(this.ariaLive).html(Drupal.t('Autocomplete popup'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ Drupal.tableDrag.prototype.initColumns = function () {
|
||||||
// Find the first field in this group.
|
// Find the first field in this group.
|
||||||
for (var d in this.tableSettings[group]) {
|
for (var d in this.tableSettings[group]) {
|
||||||
var field = $('.' + this.tableSettings[group][d].target + ':first', this.table);
|
var field = $('.' + this.tableSettings[group][d].target + ':first', this.table);
|
||||||
if (field.size() && this.tableSettings[group][d].hidden) {
|
if (field.length && this.tableSettings[group][d].hidden) {
|
||||||
var hidden = this.tableSettings[group][d].hidden;
|
var hidden = this.tableSettings[group][d].hidden;
|
||||||
var cell = field.closest('td');
|
var cell = field.closest('td');
|
||||||
break;
|
break;
|
||||||
|
@ -256,7 +256,7 @@ Drupal.tableDrag.prototype.makeDraggable = function (item) {
|
||||||
if ($('td:first .indentation:last', item).length) {
|
if ($('td:first .indentation:last', item).length) {
|
||||||
$('td:first .indentation:last', item).after(handle);
|
$('td:first .indentation:last', item).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($('.indentation', item).size(), self.indentCount);
|
self.indentCount = Math.max($('.indentation', item).length, self.indentCount);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('td:first', item).prepend(handle);
|
$('td:first', item).prepend(handle);
|
||||||
|
@ -357,7 +357,7 @@ Drupal.tableDrag.prototype.makeDraggable = function (item) {
|
||||||
if ($(item).is('.tabledrag-root')) {
|
if ($(item).is('.tabledrag-root')) {
|
||||||
// Swap with the previous top-level row.
|
// Swap with the previous top-level row.
|
||||||
var groupHeight = 0;
|
var groupHeight = 0;
|
||||||
while (previousRow && $('.indentation', previousRow).size()) {
|
while (previousRow && $('.indentation', previousRow).length) {
|
||||||
previousRow = $(previousRow).prev('tr').get(0);
|
previousRow = $(previousRow).prev('tr').get(0);
|
||||||
groupHeight += $(previousRow).is(':hidden') ? 0 : previousRow.offsetHeight;
|
groupHeight += $(previousRow).is(':hidden') ? 0 : previousRow.offsetHeight;
|
||||||
}
|
}
|
||||||
|
@ -678,7 +678,7 @@ Drupal.tableDrag.prototype.updateField = function (changedRow, group) {
|
||||||
var sourceRow = changedRow;
|
var sourceRow = changedRow;
|
||||||
if ($(previousRow).is('.draggable') && $('.' + group, previousRow).length) {
|
if ($(previousRow).is('.draggable') && $('.' + group, previousRow).length) {
|
||||||
if (this.indentEnabled) {
|
if (this.indentEnabled) {
|
||||||
if ($('.indentations', previousRow).size() == $('.indentations', changedRow)) {
|
if ($('.indentations', previousRow).length == $('.indentations', changedRow)) {
|
||||||
sourceRow = previousRow;
|
sourceRow = previousRow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -688,7 +688,7 @@ Drupal.tableDrag.prototype.updateField = function (changedRow, group) {
|
||||||
}
|
}
|
||||||
else if ($(nextRow).is('.draggable') && $('.' + group, nextRow).length) {
|
else if ($(nextRow).is('.draggable') && $('.' + group, nextRow).length) {
|
||||||
if (this.indentEnabled) {
|
if (this.indentEnabled) {
|
||||||
if ($('.indentations', nextRow).size() == $('.indentations', changedRow)) {
|
if ($('.indentations', nextRow).length == $('.indentations', changedRow)) {
|
||||||
sourceRow = nextRow;
|
sourceRow = nextRow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -744,7 +744,7 @@ Drupal.tableDrag.prototype.updateField = function (changedRow, group) {
|
||||||
switch (rowSettings.action) {
|
switch (rowSettings.action) {
|
||||||
case 'depth':
|
case 'depth':
|
||||||
// Get the depth of the target row.
|
// Get the depth of the target row.
|
||||||
targetElement.value = $('.indentation', $(sourceElement).closest('tr')).size();
|
targetElement.value = $('.indentation', $(sourceElement).closest('tr')).length;
|
||||||
break;
|
break;
|
||||||
case 'match':
|
case 'match':
|
||||||
// Update the value.
|
// Update the value.
|
||||||
|
@ -874,7 +874,7 @@ Drupal.tableDrag.prototype.row = function (tableRow, method, indentEnabled, maxD
|
||||||
this.element = tableRow;
|
this.element = tableRow;
|
||||||
this.method = method;
|
this.method = method;
|
||||||
this.group = [tableRow];
|
this.group = [tableRow];
|
||||||
this.groupDepth = $('.indentation', tableRow).size();
|
this.groupDepth = $('.indentation', tableRow).length;
|
||||||
this.changed = false;
|
this.changed = false;
|
||||||
this.table = $(tableRow).closest('table').get(0);
|
this.table = $(tableRow).closest('table').get(0);
|
||||||
this.indentEnabled = indentEnabled;
|
this.indentEnabled = indentEnabled;
|
||||||
|
@ -882,12 +882,12 @@ Drupal.tableDrag.prototype.row = function (tableRow, method, indentEnabled, maxD
|
||||||
this.direction = ''; // Direction the row is being moved.
|
this.direction = ''; // Direction the row is being moved.
|
||||||
|
|
||||||
if (this.indentEnabled) {
|
if (this.indentEnabled) {
|
||||||
this.indents = $('.indentation', tableRow).size();
|
this.indents = $('.indentation', tableRow).length;
|
||||||
this.children = this.findChildren(addClasses);
|
this.children = this.findChildren(addClasses);
|
||||||
this.group = $.merge(this.group, this.children);
|
this.group = $.merge(this.group, this.children);
|
||||||
// Find the depth of this entire group.
|
// Find the depth of this entire group.
|
||||||
for (var n = 0; n < this.group.length; n++) {
|
for (var n = 0; n < this.group.length; n++) {
|
||||||
this.groupDepth = Math.max($('.indentation', this.group[n]).size(), this.groupDepth);
|
this.groupDepth = Math.max($('.indentation', this.group[n]).length, this.groupDepth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -999,7 +999,7 @@ Drupal.tableDrag.prototype.row.prototype.validIndentInterval = function (prevRow
|
||||||
|
|
||||||
// Minimum indentation:
|
// Minimum indentation:
|
||||||
// Do not orphan the next row.
|
// Do not orphan the next row.
|
||||||
minIndent = nextRow ? $('.indentation', nextRow).size() : 0;
|
minIndent = nextRow ? $('.indentation', nextRow).length : 0;
|
||||||
|
|
||||||
// Maximum indentation:
|
// Maximum indentation:
|
||||||
if (!prevRow || $(prevRow).is(':not(.draggable)') || $(this.element).is('.tabledrag-root')) {
|
if (!prevRow || $(prevRow).is(':not(.draggable)') || $(this.element).is('.tabledrag-root')) {
|
||||||
|
@ -1011,7 +1011,7 @@ Drupal.tableDrag.prototype.row.prototype.validIndentInterval = function (prevRow
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Do not go deeper than as a child of the previous row.
|
// Do not go deeper than as a child of the previous row.
|
||||||
maxIndent = $('.indentation', prevRow).size() + ($(prevRow).is('.tabledrag-leaf') ? 0 : 1);
|
maxIndent = $('.indentation', prevRow).length + ($(prevRow).is('.tabledrag-leaf') ? 0 : 1);
|
||||||
// Limit by the maximum allowed depth for the table.
|
// Limit by the maximum allowed depth for the table.
|
||||||
if (this.maxDepth) {
|
if (this.maxDepth) {
|
||||||
maxIndent = Math.min(maxIndent, this.maxDepth - (this.groupDepth - this.indents));
|
maxIndent = Math.min(maxIndent, this.maxDepth - (this.groupDepth - this.indents));
|
||||||
|
|
|
@ -8,7 +8,7 @@ Drupal.behaviors.tableSelect = {
|
||||||
|
|
||||||
Drupal.tableSelect = function () {
|
Drupal.tableSelect = function () {
|
||||||
// Do not add a "Select all" checkbox if there are no rows with checkboxes in the table
|
// Do not add a "Select all" checkbox if there are no rows with checkboxes in the table
|
||||||
if ($('td input:checkbox', this).size() == 0) {
|
if ($('td input:checkbox', this).length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ Drupal.behaviors.blockDrag = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// This region has become empty.
|
// This region has become empty.
|
||||||
if ($(this).next('tr').is(':not(.draggable)') || $(this).next('tr').size() == 0) {
|
if ($(this).next('tr').is(':not(.draggable)') || $(this).next('tr').length == 0) {
|
||||||
$(this).removeClass('region-populated').addClass('region-empty');
|
$(this).removeClass('region-populated').addClass('region-empty');
|
||||||
}
|
}
|
||||||
// This region has become populated.
|
// This region has become populated.
|
||||||
|
|
|
@ -96,7 +96,7 @@ Drupal.file = Drupal.file || {
|
||||||
|
|
||||||
// Check if we're working with an "Upload" button.
|
// Check if we're working with an "Upload" button.
|
||||||
var $enabledFields = [];
|
var $enabledFields = [];
|
||||||
if ($(this).closest('div.form-managed-file').size() > 0) {
|
if ($(this).closest('div.form-managed-file').length > 0) {
|
||||||
$enabledFields = $(this).closest('div.form-managed-file').find('input.form-file');
|
$enabledFields = $(this).closest('div.form-managed-file').find('input.form-file');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ Drupal.file = Drupal.file || {
|
||||||
progressBar: function (event) {
|
progressBar: function (event) {
|
||||||
var clickedButton = this;
|
var clickedButton = this;
|
||||||
var $progressId = $(clickedButton).closest('div.form-managed-file').find('input.file-progress');
|
var $progressId = $(clickedButton).closest('div.form-managed-file').find('input.file-progress');
|
||||||
if ($progressId.size()) {
|
if ($progressId.length) {
|
||||||
var originalName = $progressId.attr('name');
|
var originalName = $progressId.attr('name');
|
||||||
|
|
||||||
// Replace the name with the required identifier.
|
// Replace the name with the required identifier.
|
||||||
|
|
|
@ -7,7 +7,7 @@ Drupal.behaviors.openid = {
|
||||||
var cookie = $.cookie('Drupal.visitor.openid_identifier');
|
var cookie = $.cookie('Drupal.visitor.openid_identifier');
|
||||||
|
|
||||||
// This behavior attaches by ID, so is only valid once on a page.
|
// This behavior attaches by ID, so is only valid once on a page.
|
||||||
if (!$('#edit-openid-identifier.openid-processed').size()) {
|
if (!$('#edit-openid-identifier.openid-processed').length) {
|
||||||
if (cookie) {
|
if (cookie) {
|
||||||
$('#edit-openid-identifier').val(cookie);
|
$('#edit-openid-identifier').val(cookie);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ Drupal.behaviors.simpleTestMenuCollapse = {
|
||||||
$('div.simpletest-image').click(function () {
|
$('div.simpletest-image').click(function () {
|
||||||
var trs = $(this).closest('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 direction = settings.simpleTest[this.id].imageDirection;
|
||||||
var row = direction ? trs.size() - 1 : 0;
|
var row = direction ? trs.length - 1 : 0;
|
||||||
|
|
||||||
// If clicked in the middle of expanding a group, stop so we can switch directions.
|
// If clicked in the middle of expanding a group, stop so we can switch directions.
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
|
@ -35,7 +35,7 @@ Drupal.behaviors.simpleTestMenuCollapse = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (row < trs.size()) {
|
if (row < trs.length) {
|
||||||
$(trs[row]).removeClass('js-hide').show();
|
$(trs[row]).removeClass('js-hide').show();
|
||||||
row++;
|
row++;
|
||||||
timeout = setTimeout(rowToggle, 20);
|
timeout = setTimeout(rowToggle, 20);
|
||||||
|
|
|
@ -10,7 +10,7 @@ Drupal.behaviors.termDrag = {
|
||||||
attach: function (context, settings) {
|
attach: function (context, settings) {
|
||||||
var table = $('#taxonomy', context);
|
var table = $('#taxonomy', context);
|
||||||
var tableDrag = Drupal.tableDrag.taxonomy; // Get the blocks tableDrag object.
|
var tableDrag = Drupal.tableDrag.taxonomy; // Get the blocks tableDrag object.
|
||||||
var rows = $('tr', table).size();
|
var rows = $('tr', table).length;
|
||||||
|
|
||||||
// When a row is swapped, keep previous and next page classes set.
|
// When a row is swapped, keep previous and next page classes set.
|
||||||
tableDrag.row.prototype.onSwap = function (swappedRow) {
|
tableDrag.row.prototype.onSwap = function (swappedRow) {
|
||||||
|
|
|
@ -180,7 +180,7 @@ Drupal.behaviors.fieldUserRegistration = {
|
||||||
attach: function (context, settings) {
|
attach: function (context, settings) {
|
||||||
var $checkbox = $('form#field-ui-field-edit-form input#edit-instance-settings-user-register-form');
|
var $checkbox = $('form#field-ui-field-edit-form input#edit-instance-settings-user-register-form');
|
||||||
|
|
||||||
if ($checkbox.size()) {
|
if ($checkbox.length) {
|
||||||
$('input#edit-instance-required', context).once('user-register-form-checkbox', function () {
|
$('input#edit-instance-required', context).once('user-register-form-checkbox', function () {
|
||||||
$(this).bind('change', function (e) {
|
$(this).bind('change', function (e) {
|
||||||
if ($(this).attr('checked')) {
|
if ($(this).attr('checked')) {
|
||||||
|
|
Loading…
Reference in New Issue