diff --git a/core/misc/ajax.js b/core/misc/ajax.js
index d1fd1e5..3b276bf 100644
--- a/core/misc/ajax.js
+++ b/core/misc/ajax.js
@@ -256,7 +256,7 @@ Drupal.ajax = function (base, element, element_settings) {
}
// Bind the ajaxSubmit function to the element event.
- $(ajax.element).bind(element_settings.event, function (event) {
+ $(ajax.element).on(element_settings.event, function (event) {
return ajax.eventResponse(this, event);
});
@@ -264,7 +264,7 @@ Drupal.ajax = function (base, element, element_settings) {
// can be triggered through keyboard input as well as e.g. a mousedown
// action.
if (element_settings.keypress) {
- $(ajax.element).keypress(function (event) {
+ $(ajax.element).on('keypress', function (event) {
return ajax.keypressResponse(this, event);
});
}
@@ -273,7 +273,7 @@ Drupal.ajax = function (base, element, element_settings) {
// For example, prevent the browser default action of a click, even if the
// AJAX behavior binds to mousedown.
if (element_settings.prevent) {
- $(ajax.element).bind(element_settings.prevent, false);
+ $(ajax.element).on(element_settings.prevent, false);
}
};
diff --git a/core/misc/autocomplete.js b/core/misc/autocomplete.js
index fa74a75..1d7a6db 100644
--- a/core/misc/autocomplete.js
+++ b/core/misc/autocomplete.js
@@ -16,7 +16,7 @@ Drupal.behaviors.autocomplete = {
var $input = $('#' + this.id.substr(0, this.id.length - 13))
.prop('autocomplete', 'OFF')
.attr('aria-autocomplete', 'list');
- $($input[0].form).submit(Drupal.autocompleteSubmit);
+ $($input[0].form).on('submit', Drupal.autocompleteSubmit);
$input.parent()
.attr('role', 'application')
.append($('')
@@ -49,9 +49,9 @@ Drupal.jsAC = function ($input, db) {
this.db = db;
$input
- .keydown(function (event) { return ac.onkeydown(this, event); })
- .keyup(function (event) { ac.onkeyup(this, event); })
- .blur(function () { ac.hidePopup(); ac.db.cancel(); });
+ .on('keydown', function (event) { return ac.onkeydown(this, event); })
+ .on('keyup', function (event) { ac.onkeyup(this, event); })
+ .on('blur', function () { ac.hidePopup(); ac.db.cancel(); });
};
/**
@@ -227,9 +227,9 @@ Drupal.jsAC.prototype.found = function (matches) {
if (matches.hasOwnProperty(key)) {
$('
')
.html($('').html(matches[key]))
- .mousedown(function () { ac.select(this); })
- .mouseover(function () { ac.highlight(this); })
- .mouseout(function () { ac.unhighlight(this); })
+ .on('mousedown', function () { ac.select(this); })
+ .on('mouseover', function () { ac.highlight(this); })
+ .on('mouseout', function () { ac.unhighlight(this); })
.data('autocompleteValue', key)
.appendTo(ul);
}
diff --git a/core/misc/collapse.js b/core/misc/collapse.js
index 9860ebf..33e5271 100644
--- a/core/misc/collapse.js
+++ b/core/misc/collapse.js
@@ -50,7 +50,7 @@ $.extend(CollapsibleDetails.prototype, {
setupSummary: function () {
this.$summary = $('');
this.$node
- .bind('summaryUpdated', $.proxy(this.onSummaryUpdated, this))
+ .on('summaryUpdated', $.proxy(this.onSummaryUpdated, this))
.trigger('summaryUpdated');
},
/**
@@ -70,7 +70,7 @@ $.extend(CollapsibleDetails.prototype, {
.attr('href', '#' + this.$node.attr('id'))
.prepend($legend.contents())
.appendTo($legend)
- .click($.proxy(this.onLegendClick, this));
+ .on('click', $.proxy(this.onLegendClick, this));
$legend.append(this.$summary);
},
/**
diff --git a/core/misc/form.js b/core/misc/form.js
index d97559d..ff134e2 100644
--- a/core/misc/form.js
+++ b/core/misc/form.js
@@ -31,8 +31,8 @@ $.fn.drupalSetSummary = function (callback) {
.data('summaryCallback', callback)
// To prevent duplicate events, the handlers are first removed and then
// (re-)added.
- .unbind('formUpdated.summary')
- .bind('formUpdated.summary', function () {
+ .off('formUpdated.summary')
+ .on('formUpdated.summary', function () {
self.trigger('summaryUpdated');
})
// The actual summaryUpdated handler doesn't fire when the callback is
@@ -53,7 +53,7 @@ Drupal.behaviors.formUpdated = {
.find(':input').addBack().filter(':input')
// To prevent duplicate events, the handlers are first removed and then
// (re-)added.
- .unbind(events).bind(events, function () {
+ .off(events).on(events, function () {
$(this).trigger('formUpdated');
});
}
diff --git a/core/misc/machine-name.js b/core/misc/machine-name.js
index 9369e85..53ed668 100644
--- a/core/misc/machine-name.js
+++ b/core/misc/machine-name.js
@@ -35,9 +35,9 @@ Drupal.behaviors.machineName = {
var data = e.data;
e.preventDefault();
data.$wrapper.show();
- data.$target.focus();
+ data.$target.trigger('focus');
data.$suffix.hide();
- data.$source.unbind('.machineName');
+ data.$source.off('.machineName');
}
function machineNameHandler(e) {
@@ -109,16 +109,16 @@ Drupal.behaviors.machineName = {
options: options
};
// If it is editable, append an edit link.
- var $link = $('').bind('click', eventData, clickEditHandler);
+ var $link = $('').on('click', eventData, clickEditHandler);
$suffix.append(' ').append($link);
// Preview the machine name in realtime when the human-readable name
// changes, but only if there is no machine name yet; i.e., only upon
// initial creation, not when editing.
if ($target.val() === '') {
- $source.bind('keyup.machineName change.machineName input.machineName', eventData, machineNameHandler)
+ $source.on('keyup.machineName change.machineName input.machineName', eventData, machineNameHandler)
// Initialize machine name preview.
- .keyup();
+ .trigger('keyup');
}
}
}
diff --git a/core/misc/states.js b/core/misc/states.js
index de6e6b8..6c33f15 100644
--- a/core/misc/states.js
+++ b/core/misc/states.js
@@ -118,7 +118,7 @@ states.Dependent.prototype = {
this.values[selector][state.name] = null;
// Monitor state changes of the specified state for this dependee.
- $(selector).bind('state:' + state, {selector: selector, state: state}, stateEventHandler);
+ $(selector).on('state:' + state, {selector: selector, state: state}, stateEventHandler);
// Make sure the event we just bound ourselves to is actually fired.
new states.Trigger({ selector: selector, state: state });
@@ -348,7 +348,7 @@ states.Trigger.prototype = {
var oldValue = valueFn.call(this.element);
// Attach the event callback.
- this.element.bind(event, $.proxy(function (e) {
+ this.element.on(event, $.proxy(function (e) {
var value = valueFn.call(this.element, e);
// Only trigger the event if the value has actually changed.
if (oldValue !== value) {
@@ -500,7 +500,7 @@ states.State.prototype = {
* can override these state change handlers for particular parts of a page.
*/
-$(document).bind('state:disabled', function(e) {
+$(document).on('state:disabled', function (e) {
// Only act when this change was triggered by a dependency and not by the
// element monitoring itself.
if (e.trigger) {
@@ -514,7 +514,7 @@ $(document).bind('state:disabled', function(e) {
}
});
-$(document).bind('state:required', function(e) {
+$(document).on('state:required', function (e) {
if (e.trigger) {
if (e.value) {
$(e.target).closest('.form-item, .form-wrapper').find('label').append('*');
@@ -525,22 +525,22 @@ $(document).bind('state:required', function(e) {
}
});
-$(document).bind('state:visible', function(e) {
+$(document).on('state:visible', function (e) {
if (e.trigger) {
$(e.target).closest('.form-item, .form-submit, .form-wrapper').toggle(e.value);
}
});
-$(document).bind('state:checked', function(e) {
+$(document).on('state:checked', function (e) {
if (e.trigger) {
$(e.target).prop('checked', e.value);
}
});
-$(document).bind('state:collapsed', function(e) {
+$(document).on('state:collapsed', function (e) {
if (e.trigger) {
if ($(e.target).is('[open]') === e.value) {
- $(e.target).find('> summary a').click();
+ $(e.target).find('> summary a').trigger('click');
}
}
});
diff --git a/core/misc/tabbingmanager.js b/core/misc/tabbingmanager.js
index f212a1d..889067b 100644
--- a/core/misc/tabbingmanager.js
+++ b/core/misc/tabbingmanager.js
@@ -133,7 +133,7 @@ $.extend(TabbingManager.prototype, {
if ($hasFocus.length === 0) {
$hasFocus = $set.eq(0);
}
- $hasFocus.focus();
+ $hasFocus.trigger('focus');
},
/**
diff --git a/core/misc/tabledrag.js b/core/misc/tabledrag.js
index 5254224..33eeb57 100644
--- a/core/misc/tabledrag.js
+++ b/core/misc/tabledrag.js
@@ -106,7 +106,7 @@ Drupal.tableDrag = function (table, tableSettings) {
// Add a link before the table for users to show or hide weight columns.
$table.before($('')
.attr('title', Drupal.t('Re-order rows by numerical weight instead of dragging.'))
- .click($.proxy(function (e) {
+ .on('click', $.proxy(function (e) {
e.preventDefault();
this.toggleColumns();
}, this))
@@ -132,7 +132,7 @@ Drupal.tableDrag = function (table, tableSettings) {
}
// React to localStorage event showing or hiding weight columns.
- $(window).bind('storage', $.proxy(function (e) {
+ $(window).on('storage', $.proxy(function (e) {
// Only react to 'Drupal.tableDrag.showWeight' value change.
if (e.originalEvent.key === 'Drupal.tableDrag.showWeight') {
// This was changed in another window, get the new value for this window.
@@ -332,32 +332,32 @@ Drupal.tableDrag.prototype.makeDraggable = function (item) {
});
}
else {
- handle.mousedown(function (event) {
+ handle.on('mousedown', function (event) {
event.preventDefault();
self.dragStart(event, self, item);
});
}
// Prevent the anchor tag from jumping us to the top of the page.
- handle.click(function (e) {
+ handle.on('click', function (e) {
e.preventDefault();
});
// Set blur cleanup when a handle is focused.
- handle.focus(function () {
+ handle.on('focus', function () {
self.safeBlur = true;
});
// On blur, fire the same function as a touchend/mouseup. This is used to
// update values after a row has been moved through the keyboard support.
- handle.blur(function (event) {
+ handle.on('blur', function (event) {
if (self.rowObject && self.safeBlur) {
self.dropRow(event, self);
}
});
// Add arrow-key support to the handle.
- handle.keydown(function (event) {
+ handle.on('keydown', function (event) {
// If a rowObject doesn't yet exist and this isn't the tab key.
if (event.keyCode !== 9 && !self.rowObject) {
self.rowObject = new self.row(item, 'keyboard', self.indentEnabled, self.maxDepth, true);
@@ -406,7 +406,7 @@ Drupal.tableDrag.prototype.makeDraggable = function (item) {
self.rowObject.indent(0);
window.scrollBy(0, -parseInt(item.offsetHeight, 10));
}
- handle.get(0).focus(); // Regain focus after the DOM manipulation.
+ handle.trigger('focus'); // Regain focus after the DOM manipulation.
}
break;
case 39: // Right arrow.
@@ -448,7 +448,7 @@ Drupal.tableDrag.prototype.makeDraggable = function (item) {
self.rowObject.indent(0);
window.scrollBy(0, parseInt(item.offsetHeight, 10));
}
- handle.get(0).focus(); // Regain focus after the DOM manipulation.
+ handle.trigger('focus'); // Regain focus after the DOM manipulation.
}
break;
}
@@ -472,7 +472,7 @@ Drupal.tableDrag.prototype.makeDraggable = function (item) {
// Compatibility addition, return false on keypress to prevent unwanted scrolling.
// IE and Safari will suppress scrolling on keydown, but all other browsers
// need to return false on keypress. http://www.quirksmode.org/js/keys.html
- handle.keypress(function (event) {
+ handle.on('keypress', function (event) {
switch (event.keyCode) {
case 37: // Left arrow.
case 38: // Up arrow.
diff --git a/core/misc/tableheader.js b/core/misc/tableheader.js
index f1aba96..b22e2a5 100644
--- a/core/misc/tableheader.js
+++ b/core/misc/tableheader.js
@@ -93,7 +93,7 @@ function TableHeader(table) {
this.tableOffset = this.$originalTable.offset();
// React to columns change to avoid making checks in the scroll callback.
- this.$originalTable.bind('columnschange', {tableHeader: this}, function (e, display) {
+ this.$originalTable.on('columnschange', {tableHeader: this}, function (e, display) {
var tableHeader = e.data.tableHeader;
if (tableHeader.displayWeight === null || tableHeader.displayWeight !== display) {
tableHeader.recalculateSticky();
diff --git a/core/misc/tableselect.js b/core/misc/tableselect.js
index c8d45ba..aa32851 100644
--- a/core/misc/tableselect.js
+++ b/core/misc/tableselect.js
@@ -28,7 +28,7 @@ Drupal.tableSelect = function () {
};
// Find all
with class select-all, and insert the check all checkbox.
- $table.find('th.select-all').prepend($('').attr('title', strings.selectAll)).click(function (event) {
+ $table.find('th.select-all').prepend($('').attr('title', strings.selectAll)).on('click', function (event) {
if ($(event.target).is('input[type="checkbox"]')) {
// Loop through all checkboxes and set their state to the select all checkbox' state.
checkboxes.each(function () {
@@ -42,7 +42,7 @@ Drupal.tableSelect = function () {
});
// For each of the checkboxes within the table that are not disabled.
- checkboxes = $table.find('td input[type="checkbox"]:enabled').click(function (e) {
+ checkboxes = $table.find('td input[type="checkbox"]:enabled').on('click', function (e) {
// Either add or remove the selected class based on the state of the check all checkbox.
$(this).closest('tr').toggleClass('selected', this.checked);
diff --git a/core/misc/vertical-tabs.js b/core/misc/vertical-tabs.js
index 1421533..3e8fbc0 100644
--- a/core/misc/vertical-tabs.js
+++ b/core/misc/vertical-tabs.js
@@ -90,24 +90,24 @@ Drupal.verticalTab = function (settings) {
this.link.attr('href', '#' + settings.details.attr('id'));
- this.link.click(function (e) {
+ this.link.on('click', function (e) {
e.preventDefault();
self.focus();
});
// Keyboard events added:
// Pressing the Enter key will open the tab pane.
- this.link.keydown(function(event) {
+ this.link.on('keydown', function (event) {
event.preventDefault();
if (event.keyCode === 13) {
self.focus();
// Set focus on the first input field of the visible details/tab pane.
- $(".vertical-tabs-pane :input:visible:enabled:first").focus();
+ $(".vertical-tabs-pane :input:visible:enabled:first").trigger('focus');
}
});
this.details
- .bind('summaryUpdated', function () {
+ .on('summaryUpdated', function () {
self.updateSummary();
})
.trigger('summaryUpdated');
diff --git a/core/modules/block/block.js b/core/modules/block/block.js
index 7025ce1..9ff920d 100644
--- a/core/modules/block/block.js
+++ b/core/modules/block/block.js
@@ -78,7 +78,7 @@ Drupal.behaviors.blockDrag = {
window.alert(Drupal.t('The block cannot be placed in this region.'));
// Simulate that there was a selected element change, so the row is put
// back to from where the user tried to drag it.
- regionField.change();
+ regionField.trigger('change');
}
else if ($rowElement.prev('tr').is('.region-message')) {
var weightField = $rowElement.find('select.block-weight');
@@ -94,7 +94,7 @@ Drupal.behaviors.blockDrag = {
// Add the behavior to each region select list.
$(context).find('select.block-region-select').once('block-region-select', function () {
- $(this).change(function (event) {
+ $(this).on('change', function (event) {
// Make our new row and select field.
var row = $(this).closest('tr');
var select = $(this);
@@ -106,7 +106,7 @@ Drupal.behaviors.blockDrag = {
// Modify empty regions with added or removed fields.
checkEmptyRegions(table, row);
// Remove focus from selectbox.
- select.get(0).blur();
+ select.trigger('blur');
});
});
diff --git a/core/modules/ckeditor/js/ckeditor.admin.js b/core/modules/ckeditor/js/ckeditor.admin.js
index 5ccc7ec..c5b276c 100644
--- a/core/modules/ckeditor/js/ckeditor.admin.js
+++ b/core/modules/ckeditor/js/ckeditor.admin.js
@@ -111,7 +111,7 @@ Drupal.behaviors.ckeditorAdmin = {
}
}
$messages.text(message);
- $link.focus();
+ $link.trigger('focus');
event.preventDefault();
}
@@ -171,7 +171,7 @@ Drupal.behaviors.ckeditorAdmin = {
// Update the toolbar config after updating a sortable.
var toolbarConfig = [];
var $button = ui.item;
- $button.find('a').focus();
+ $button.find('a').trigger('focus');
$ckeditorToolbar.find('.ckeditor-toolbar-active ul').each(function () {
var $rowButtons = $(this).find('li');
var rowConfig = [];
diff --git a/core/modules/color/color.js b/core/modules/color/color.js
index ca74657..704fc1c 100644
--- a/core/modules/color/color.js
+++ b/core/modules/color/color.js
@@ -55,7 +55,7 @@ Drupal.behaviors.color = {
}
// Set up colorScheme selector.
- form.find('#edit-scheme').change(function () {
+ form.find('#edit-scheme').on('change', function () {
var schemes = settings.color.schemes, colorScheme = this.options[this.selectedIndex].value;
if (colorScheme !== '' && schemes[colorScheme]) {
// Get colors of active scheme.
@@ -184,8 +184,8 @@ Drupal.behaviors.color = {
var input = e.target;
// Remove old bindings.
if (focused) {
- $(focused).unbind('keyup', farb.updateValue)
- .unbind('keyup', preview).unbind('keyup', resetScheme)
+ $(focused).off('keyup', farb.updateValue)
+ .off('keyup', preview).off('keyup', resetScheme)
.parent().removeClass('item-selected');
}
@@ -193,7 +193,7 @@ Drupal.behaviors.color = {
focused = input;
farb.linkTo(function (color) { callback(input, color, true, false); });
farb.setColor(input.value);
- $(focused).keyup(farb.updateValue).keyup(preview).keyup(resetScheme)
+ $(focused).on('keyup', farb.updateValue).on('keyup', preview).on('keyup', resetScheme)
.parent().addClass('item-selected');
}
@@ -240,11 +240,11 @@ Drupal.behaviors.color = {
$(this).after(hook);
hooks.push(hook);
- $(this).parent().find('.lock').click();
+ $(this).parent().find('.lock').trigger('click');
this.i = i;
inputs.push(this);
})
- .focus(focus);
+ .on('focus', focus);
form.find('#palette label');
diff --git a/core/modules/editor/js/editor.js b/core/modules/editor/js/editor.js
index 9bbce1d..8c6244c 100644
--- a/core/modules/editor/js/editor.js
+++ b/core/modules/editor/js/editor.js
@@ -55,7 +55,7 @@ Drupal.behaviors.editor = {
});
}
// Detach any editor when the containing form is submitted.
- $this.parents('form').submit(function (event) {
+ $this.parents('form').on('submit', function (event) {
// Do not detach if the event was canceled.
if (event.isDefaultPrevented()) {
return;
diff --git a/core/modules/field_ui/field_ui.js b/core/modules/field_ui/field_ui.js
index 3000cd1..15b4d45 100644
--- a/core/modules/field_ui/field_ui.js
+++ b/core/modules/field_ui/field_ui.js
@@ -34,7 +34,7 @@ Drupal.fieldUIFieldOverview = {
var $this = $(this);
this.targetSelect = $this.closest('tr').find('.widget-type-select');
- $this.bind('change keyup', function () {
+ $this.on('change keyup', function () {
var selectedFieldType = this.options[this.selectedIndex].value;
var options = (selectedFieldType in widgetTypes ? widgetTypes[selectedFieldType] : []);
this.targetSelect.fieldUIPopulateOptions(options);
@@ -53,11 +53,11 @@ Drupal.fieldUIFieldOverview = {
this.targetTextfield = $tr.find('.label-textfield');
this.targetTextfield
.data('field_ui_edited', false)
- .bind('keyup', function (e) {
+ .on('keyup', function (e) {
$(this).data('field_ui_edited', $(this).val() !== '');
});
- $this.bind('change keyup', function (e, updateText) {
+ $this.on('change keyup', function (e, updateText) {
updateText = (typeof updateText === 'undefined' ? true : updateText);
var selectedField = this.options[this.selectedIndex].value;
var selectedFieldType = (selectedField in fields ? fields[selectedField].type : null);
@@ -259,7 +259,7 @@ Drupal.fieldUIOverview = {
// Fire the Ajax update.
$('input[name=refresh_rows]').val(rowNames.join(' '));
- $('input#edit-refresh').mousedown();
+ $('input#edit-refresh').trigger('mousedown');
// Disabled elements do not appear in POST ajax data, so we mark the
// elements disabled only after firing the request.
@@ -292,7 +292,7 @@ Drupal.fieldUIDisplayOverview.field = function (row, data) {
// Attach change listener to the 'formatter type' select.
this.$formatSelect = $(row).find('select.field-formatter-type');
- this.$formatSelect.change(Drupal.fieldUIOverview.onChange);
+ this.$formatSelect.on('change', Drupal.fieldUIOverview.onChange);
return this;
};
diff --git a/core/modules/file/file.js b/core/modules/file/file.js
index e1ee323..a3c0092 100644
--- a/core/modules/file/file.js
+++ b/core/modules/file/file.js
@@ -23,7 +23,7 @@ Drupal.behaviors.fileValidateAutoAttach = {
elements = settings.file.elements;
for (selector in elements) {
if (elements.hasOwnProperty(selector)) {
- $context.find(selector).bind('change', {extensions: elements[selector]}, validateExtension);
+ $context.find(selector).on('change', {extensions: elements[selector]}, validateExtension);
}
}
}
@@ -36,7 +36,7 @@ Drupal.behaviors.fileValidateAutoAttach = {
elements = settings.file.elements;
for (selector in elements) {
if (elements.hasOwnProperty(selector)) {
- $context.find(selector).unbind('change', validateExtension);
+ $context.find(selector).off('change', validateExtension);
}
}
}
@@ -49,13 +49,13 @@ Drupal.behaviors.fileValidateAutoAttach = {
Drupal.behaviors.fileButtons = {
attach: function (context) {
var $context = $(context);
- $context.find('input.form-submit').bind('mousedown', Drupal.file.disableFields);
- $context.find('div.form-managed-file input.form-submit').bind('mousedown', Drupal.file.progressBar);
+ $context.find('input.form-submit').on('mousedown', Drupal.file.disableFields);
+ $context.find('div.form-managed-file input.form-submit').on('mousedown', Drupal.file.progressBar);
},
detach: function (context) {
var $context = $(context);
- $context.find('input.form-submit').unbind('mousedown', Drupal.file.disableFields);
- $context.find('div.form-managed-file input.form-submit').unbind('mousedown', Drupal.file.progressBar);
+ $context.find('input.form-submit').off('mousedown', Drupal.file.disableFields);
+ $context.find('div.form-managed-file input.form-submit').off('mousedown', Drupal.file.progressBar);
}
};
@@ -64,10 +64,10 @@ Drupal.behaviors.fileButtons = {
*/
Drupal.behaviors.filePreviewLinks = {
attach: function (context) {
- $(context).find('div.form-managed-file .file a, .file-widget .file a').bind('click',Drupal.file.openInNewWindow);
+ $(context).find('div.form-managed-file .file a, .file-widget .file a').on('click',Drupal.file.openInNewWindow);
},
detach: function (context){
- $(context).find('div.form-managed-file .file a, .file-widget .file a').unbind('click', Drupal.file.openInNewWindow);
+ $(context).find('div.form-managed-file .file a, .file-widget .file a').off('click', Drupal.file.openInNewWindow);
}
};
diff --git a/core/modules/filter/filter.admin.js b/core/modules/filter/filter.admin.js
index f55159a..f25f516 100644
--- a/core/modules/filter/filter.admin.js
+++ b/core/modules/filter/filter.admin.js
@@ -19,7 +19,7 @@ Drupal.behaviors.filterStatus = {
// Bind click handler to this checkbox to conditionally show and hide the
// filter's tableDrag row and vertical tab pane.
- $checkbox.bind('click.filterUpdate', function () {
+ $checkbox.on('click.filterUpdate', function () {
if ($checkbox.is(':checked')) {
$row.show();
if (tab) {
diff --git a/core/modules/filter/filter.js b/core/modules/filter/filter.js
index 4bc8c18..9ee5f74 100644
--- a/core/modules/filter/filter.js
+++ b/core/modules/filter/filter.js
@@ -15,12 +15,12 @@ Drupal.behaviors.filterGuidelines = {
$(context).find('.filter-guidelines').once('filter-guidelines')
.find(':header').hide()
.closest('.filter-wrapper').find('select.filter-list')
- .bind('change', function () {
+ .on('change', function () {
$(this).closest('.filter-wrapper')
.find('.filter-guidelines-item').hide()
.siblings('.filter-guidelines-' + this.value).show();
})
- .change();
+ .trigger('change');
}
};
diff --git a/core/modules/menu/menu.js b/core/modules/menu/menu.js
index 77baddb..c9e14b5 100644
--- a/core/modules/menu/menu.js
+++ b/core/modules/menu/menu.js
@@ -39,7 +39,7 @@ Drupal.behaviors.menuLinkAutomaticTitle = {
$link_title.data('menuLinkAutomaticTitleOveridden', true);
}
// Whenever the value is changed manually, disable this behavior.
- $link_title.keyup(function () {
+ $link_title.on('keyup', function () {
$link_title.data('menuLinkAutomaticTitleOveridden', true);
});
// Global trigger on checkbox (do not fill-in a value when disabled).
@@ -57,7 +57,7 @@ Drupal.behaviors.menuLinkAutomaticTitle = {
$checkbox.trigger('formUpdated');
});
// Take over any title change.
- $title.keyup(function () {
+ $title.on('keyup', function () {
if (!$link_title.data('menuLinkAutomaticTitleOveridden') && $checkbox.is(':checked')) {
$link_title.val($title.val());
$link_title.val($title.val()).trigger('formUpdated');
diff --git a/core/modules/openid/openid.js b/core/modules/openid/openid.js
index ac69b82..f98c11b 100644
--- a/core/modules/openid/openid.js
+++ b/core/modules/openid/openid.js
@@ -5,7 +5,7 @@
Drupal.behaviors.openid = {
attach: function (context) {
function clearStatus ($form) {
- $form.find('input:first').focus();
+ $form.find('input:first').trigger('focus');
// Clear input fields and reset any validation errors.
$form[0].reset();
@@ -22,14 +22,14 @@ Drupal.behaviors.openid = {
// Change link text and triggers loginchange event.
var toggleClick = true;
- $('#block-user-login .openid-link').on('click', function() {
+ $('#block-user-login .openid-link').on('click', function () {
if (toggleClick) {
$(this).html(Drupal.t('Cancel OpenID login'));
$login_form.hide();
$openid_form.show();
clearStatus($login_form);
// Move focus to OpenID input.
- $('#edit-openid-identifier').focus();
+ $('#edit-openid-identifier').trigger('focus');
}
else {
$(this).html(Drupal.t('Log in using OpenID'));
diff --git a/core/modules/overlay/overlay-child.js b/core/modules/overlay/overlay-child.js
index be43628..971c60c 100644
--- a/core/modules/overlay/overlay-child.js
+++ b/core/modules/overlay/overlay-child.js
@@ -67,11 +67,11 @@ Drupal.behaviors.overlayChild = {
// overlay and how to disable it. Make sure both links are visible when
// either one has focus and add a class to the wrapper for styling purposes.
$(context).find('#overlay-disable-message')
- .focusin(function () {
+ .on('focusin', function () {
$(this).addClass('overlay-disable-message-focused')
.find('a.element-focusable').removeClass('element-invisible');
})
- .focusout(function () {
+ .on('focusout', function () {
$(this).removeClass('overlay-disable-message-focused')
.find('a.element-focusable').addClass('element-invisible');
});
@@ -107,7 +107,7 @@ Drupal.overlayChild.attachBehaviors = function (context, settings) {
* to bind their own handlers to links and also to prevent overlay's handling.
*/
Drupal.overlayChild.behaviors.addClickHandler = function (context, settings) {
- $(document).bind('click.drupal-overlay mouseup.drupal-overlay', $.proxy(parent.Drupal.overlay, 'eventhandlerOverrideLink'));
+ $(document).on('click.drupal-overlay mouseup.drupal-overlay', $.proxy(parent.Drupal.overlay, 'eventhandlerOverrideLink'));
};
/**
@@ -140,7 +140,7 @@ Drupal.overlayChild.behaviors.loading = function (context, settings) {
var text = Drupal.t('Loading');
var dots = '';
- $(document).bind('drupalOverlayBeforeLoad.drupal-overlay.drupal-overlay-child-loading', function () {
+ $(document).on('drupalOverlayBeforeLoad.drupal-overlay.drupal-overlay-child-loading', function () {
$title = $('#overlay-title').text(text);
setInterval(function () {
dots = (dots.length > 10) ? '' : dots + '.';
@@ -155,7 +155,7 @@ Drupal.overlayChild.behaviors.loading = function (context, settings) {
Drupal.overlayChild.behaviors.tabs = function (context, settings) {
var $tabsLinks = $('#overlay-tabs > li > a');
- $('#overlay-tabs > li > a').bind('click.drupal-overlay', function () {
+ $('#overlay-tabs > li > a').on('click.drupal-overlay', function () {
var active_tab = Drupal.t('(active tab)');
$tabsLinks.parent().siblings().removeClass('active').find('element-invisible:contains(' + active_tab + ')').appendTo(this);
$(this).parent().addClass('active');
@@ -174,7 +174,7 @@ Drupal.overlayChild.behaviors.shortcutAddLink = function (context, settings) {
$addToShortcuts.insertAfter('#overlay-title');
}
- $(document).bind('drupalOverlayBeforeLoad.drupal-overlay.drupal-overlay-child-loading', function () {
+ $(document).on('drupalOverlayBeforeLoad.drupal-overlay.drupal-overlay-child-loading', function () {
$('#overlay-titlebar').find('.add-or-remove-shortcuts').remove();
});
};
diff --git a/core/modules/overlay/overlay-parent.js b/core/modules/overlay/overlay-parent.js
index a8a32d6..ce1c90e 100644
--- a/core/modules/overlay/overlay-parent.js
+++ b/core/modules/overlay/overlay-parent.js
@@ -19,7 +19,7 @@ Drupal.behaviors.overlayParent = {
$(window)
// When the hash (URL fragment) changes, open the overlay if needed.
- .bind('hashchange.drupal-overlay', $.proxy(Drupal.overlay, 'eventhandlerOperateByURLFragment'))
+ .on('hashchange.drupal-overlay', $.proxy(Drupal.overlay, 'eventhandlerOperateByURLFragment'))
// Trigger the hashchange handler once, after the page is loaded, so that
// permalinks open the overlay.
.triggerHandler('hashchange.drupal-overlay');
@@ -35,7 +35,7 @@ Drupal.behaviors.overlayParent = {
// the document and only handle events that bubble up. This allows other
// scripts to bind their own handlers to links and also to prevent
// overlay's handling.
- .bind('click.drupal-overlay mouseup.drupal-overlay', $.proxy(Drupal.overlay, 'eventhandlerOverrideLink'));
+ .on('click.drupal-overlay mouseup.drupal-overlay', $.proxy(Drupal.overlay, 'eventhandlerOverrideLink'));
}
};
@@ -121,27 +121,27 @@ Drupal.overlay.create = function () {
this.inactiveFrame = this.$iframeB = $(Drupal.theme('overlayElement'))
.appendTo(this.$container);
- this.$iframeA.bind('load.drupal-overlay', { self: this.$iframeA[0], sibling: this.$iframeB }, $.proxy(this, 'loadChild'));
- this.$iframeB.bind('load.drupal-overlay', { self: this.$iframeB[0], sibling: this.$iframeA }, $.proxy(this, 'loadChild'));
+ this.$iframeA.on('load.drupal-overlay', { self: this.$iframeA[0], sibling: this.$iframeB }, $.proxy(this, 'loadChild'));
+ this.$iframeB.on('load.drupal-overlay', { self: this.$iframeB[0], sibling: this.$iframeA }, $.proxy(this, 'loadChild'));
// Add a second class "drupal-overlay-open" to indicate these event handlers
// should only be bound when the overlay is open.
var eventClass = '.drupal-overlay.drupal-overlay-open';
$(window)
- .bind('resize' + eventClass, $.proxy(this, 'eventhandlerOuterResize'));
+ .on('resize' + eventClass, $.proxy(this, 'eventhandlerOuterResize'));
$(document)
- .bind('drupalViewportOffsetChange' + eventClass, $.proxy(this, 'eventhandlerViewportOffsetChange'))
- .bind('drupalOverlayLoad' + eventClass, $.proxy(this, 'eventhandlerOuterResize'))
- .bind('drupalOverlayReady' + eventClass +
+ .on('drupalViewportOffsetChange' + eventClass, $.proxy(this, 'eventhandlerViewportOffsetChange'))
+ .on('drupalOverlayLoad' + eventClass, $.proxy(this, 'eventhandlerOuterResize'))
+ .on('drupalOverlayReady' + eventClass +
' drupalOverlayClose' + eventClass, $.proxy(this, 'eventhandlerSyncURLFragment'))
- .bind('drupalOverlayClose' + eventClass, $.proxy(this, 'eventhandlerRefreshPage'))
- .bind('drupalOverlayBeforeClose' + eventClass +
+ .on('drupalOverlayClose' + eventClass, $.proxy(this, 'eventhandlerRefreshPage'))
+ .on('drupalOverlayBeforeClose' + eventClass +
' drupalOverlayBeforeLoad' + eventClass +
' drupalOverlayResize' + eventClass, $.proxy(this, 'eventhandlerDispatchEvent'));
$(document)
- .bind('drupalOverlayResize' + eventClass, $.proxy(this, 'eventhandlerAlterDisplacedElements'))
- .bind('drupalOverlayClose' + eventClass, $.proxy(this, 'eventhandlerRestoreDisplacedElements'));
+ .on('drupalOverlayResize' + eventClass, $.proxy(this, 'eventhandlerAlterDisplacedElements'))
+ .on('drupalOverlayClose' + eventClass, $.proxy(this, 'eventhandlerRestoreDisplacedElements'));
};
/**
@@ -218,7 +218,7 @@ Drupal.overlay.close = function () {
* Destroy the overlay.
*/
Drupal.overlay.destroy = function () {
- $([document, window]).unbind('.drupal-overlay-open');
+ $([document, window]).off('.drupal-overlay-open');
this.$container.remove();
this.$container = null;
diff --git a/core/modules/shortcut/shortcut.admin.js b/core/modules/shortcut/shortcut.admin.js
index 7cad31f..c95e4fd 100644
--- a/core/modules/shortcut/shortcut.admin.js
+++ b/core/modules/shortcut/shortcut.admin.js
@@ -11,7 +11,7 @@ Drupal.behaviors.newSet = {
var selectDefault = function() {
$(this).closest('form').find('.form-item-set .form-type-radio:last input').prop('checked', true);
};
- $('div.form-item-new input').focus(selectDefault).keyup(selectDefault);
+ $('div.form-item-new input').on('focus', selectDefault).on('keyup', selectDefault);
}
};
diff --git a/core/modules/simpletest/simpletest.js b/core/modules/simpletest/simpletest.js
index 7048966..9a5a084 100644
--- a/core/modules/simpletest/simpletest.js
+++ b/core/modules/simpletest/simpletest.js
@@ -15,7 +15,7 @@ Drupal.behaviors.simpleTestMenuCollapse = {
$this.html(settings.simpleTest.images[direction]);
// Adds group toggling functionality to arrow images.
- $this.click(function () {
+ $this.on('click', function () {
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;
@@ -80,7 +80,7 @@ Drupal.behaviors.simpleTestSelectAll = {
}
// Have the single-test checkboxes follow the group checkbox.
- groupCheckbox.change(function () {
+ groupCheckbox.on('change', function () {
var checked = $(this).prop('checked');
for (var i = 0; i < testCheckboxes.length; i++) {
$('#' + testCheckboxes[i]).prop('checked', checked);
@@ -89,7 +89,7 @@ Drupal.behaviors.simpleTestSelectAll = {
// Have the group checkbox follow the single-test checkboxes.
for (var i = 0; i < testCheckboxes.length; i++) {
- $('#' + testCheckboxes[i]).change(updateGroupCheckbox);
+ $('#' + testCheckboxes[i]).on('change', updateGroupCheckbox);
}
// Initialize status for the group checkbox correctly.
diff --git a/core/modules/text/text.js b/core/modules/text/text.js
index 7e63c09..477bdbe 100644
--- a/core/modules/text/text.js
+++ b/core/modules/text/text.js
@@ -42,7 +42,7 @@ Drupal.behaviors.textSummary = {
// If no summary is set, hide the summary field.
if ($widget.find('.text-summary').val() === '') {
- $link.click();
+ $link.trigger('click');
}
});
}
diff --git a/core/modules/translation/translation.js b/core/modules/translation/translation.js
index 2232ba3..8b29efe 100644
--- a/core/modules/translation/translation.js
+++ b/core/modules/translation/translation.js
@@ -4,7 +4,7 @@
Drupal.behaviors.TranslationEnable = {
attach: function (context) {
- $('#edit-node-type-language-default, #edit-node-type-language-hidden', context).change(function(context) {
+ $('#edit-node-type-language-default, #edit-node-type-language-hidden', context).on('change', function (context) {
var default_language = $('#edit-node-type-language-default').val();
if ((default_language === 'und' || default_language === 'zxx' || default_language === 'mul') && $('#edit-node-type-language-hidden').prop('checked')) {
diff --git a/core/modules/translation_entity/translation_entity.admin.js b/core/modules/translation_entity/translation_entity.admin.js
index 2b934e8..b9247d0 100644
--- a/core/modules/translation_entity/translation_entity.admin.js
+++ b/core/modules/translation_entity/translation_entity.admin.js
@@ -23,7 +23,7 @@ Drupal.behaviors.translationEntityDependentOptions = {
var $fields = $collection.elements;
var $dependent_columns = $collection.dependent_columns;
- $fields.change(function() {
+ $fields.on('change', function () {
Drupal.behaviors.translationEntityDependentOptions.check($fields, $dependent_columns, $(this));
});
diff --git a/core/modules/user/user.js b/core/modules/user/user.js
index 45181fb..fb5f87c 100644
--- a/core/modules/user/user.js
+++ b/core/modules/user/user.js
@@ -76,7 +76,7 @@ Drupal.behaviors.password = {
// Monitor input events.
$.each([passwordInput, confirmInput], function () {
- this.bind('input', passwordCheck);
+ this.on('input', passwordCheck);
});
});
}
@@ -181,7 +181,7 @@ Drupal.behaviors.fieldUserRegistration = {
if ($checkbox.length) {
$(context).find('input#edit-instance-required').once('user-register-form-checkbox', function () {
- $(this).bind('change', function (e) {
+ $(this).on('change', function (e) {
if ($(this).prop('checked')) {
$checkbox.prop('checked', true);
}
diff --git a/core/modules/user/user.permissions.js b/core/modules/user/user.permissions.js
index 15658a9..850dd88 100644
--- a/core/modules/user/user.permissions.js
+++ b/core/modules/user/user.permissions.js
@@ -41,7 +41,7 @@ Drupal.behaviors.permissions = {
// Initialize the authenticated user checkbox.
$table.find('input[type=checkbox].rid-authenticated')
- .bind('click.permissions', self.toggle)
+ .on('click.permissions', self.toggle)
// .triggerHandler() cannot be used here, as it only affects the first
// element.
.each(self.toggle);
diff --git a/core/modules/views_ui/js/ajax.js b/core/modules/views_ui/js/ajax.js
index ef45e24..ace0319 100644
--- a/core/modules/views_ui/js/ajax.js
+++ b/core/modules/views_ui/js/ajax.js
@@ -16,13 +16,13 @@
Drupal.attachBehaviors($(ajax_popup), ajax.settings);
if (response.url) {
// Identify the button that was clicked so that .ajaxSubmit() can use it.
- // We need to do this for both .click() and .mousedown() since JavaScript
+ // We need to do this for both click and mousedown events since JavaScript
// code might trigger either behavior.
var $submit_buttons = $('input[type=submit], button', ajax_body);
- $submit_buttons.click(function(event) {
+ $submit_buttons.on('click', function () {
this.form.clk = this;
});
- $submit_buttons.mousedown(function(event) {
+ $submit_buttons.on('mousedown', function () {
this.form.clk = this;
});
@@ -87,9 +87,9 @@
*/
Drupal.behaviors.livePreview = {
attach: function (context) {
- $('input#edit-displays-live-preview', context).once('views-ajax-processed').click(function() {
+ $('input#edit-displays-live-preview', context).once('views-ajax-processed').on('click', function () {
if ($(this).is(':checked')) {
- $('#preview-submit').click();
+ $('#preview-submit').trigger('click');
}
});
}
@@ -100,7 +100,7 @@
*/
Drupal.behaviors.syncPreviewDisplay = {
attach: function (context) {
- $("#views-tabset a").once('views-ajax-processed').click(function() {
+ $("#views-tabset a").once('views-ajax-processed').on('click', function () {
var href = $(this).attr('href');
// Cut of #views-tabset.
var display_id = href.substr(11);
@@ -168,7 +168,7 @@
// of the main Edit form.
$('div#views-live-preview input[type=submit]')
.once('views-ajax-processed').each(function(event) {
- $(this).click(function () {
+ $(this).trigger('click', function () {
this.form.clk = this;
return true;
});
diff --git a/core/modules/views_ui/js/views-admin.js b/core/modules/views_ui/js/views-admin.js
index f695e77..f4878bd 100644
--- a/core/modules/views_ui/js/views-admin.js
+++ b/core/modules/views_ui/js/views-admin.js
@@ -15,7 +15,7 @@ Drupal.behaviors.viewsUiEditView.attach = function (context, settings) {
// Only show the SQL rewrite warning when the user has chosen the
// corresponding checkbox.
- jQuery('#edit-query-options-disable-sql-rewrite').click(function () {
+ jQuery('#edit-query-options-disable-sql-rewrite').on('click', function () {
jQuery('.sql-rewrite-warning').toggleClass('js-hide');
});
};
@@ -127,9 +127,9 @@ Drupal.viewsUi.FormFieldFiller.prototype.bind = function () {
this.unbind();
// Populate the form field when the source changes.
- this.source.bind('keyup.viewsUi change.viewsUi', this.populate);
+ this.source.on('keyup.viewsUi change.viewsUi', this.populate);
// Quit populating the field as soon as it gets focus.
- this.target.bind('focus.viewsUi', this.unbind);
+ this.target.on('focus.viewsUi', this.unbind);
};
/**
@@ -164,8 +164,8 @@ Drupal.viewsUi.FormFieldFiller.prototype._unbind = function () {
"use strict";
- this.source.unbind('keyup.viewsUi change.viewsUi', this.populate);
- this.target.unbind('focus.viewsUi', this.unbind);
+ this.source.off('keyup.viewsUi change.viewsUi', this.populate);
+ this.target.off('focus.viewsUi', this.unbind);
};
/**
@@ -194,12 +194,12 @@ Drupal.behaviors.addItemForm.attach = function (context) {
}
};
-Drupal.viewsUi.addItemForm = function($form) {
+Drupal.viewsUi.addItemForm = function ($form) {
"use strict";
this.$form = $form;
- this.$form.find('.views-filterable-options :checkbox').click(jQuery.proxy(this.handleCheck, this));
+ this.$form.find('.views-filterable-options :checkbox').on('click', jQuery.proxy(this.handleCheck, this));
// Find the wrapper of the displayed text.
this.$selected_div = this.$form.find('.views-selected-options').parent();
this.$selected_div.hide();
@@ -239,7 +239,7 @@ Drupal.viewsUi.addItemForm.prototype.handleCheck = function (event) {
/**
* Refresh the display of the checked items.
*/
-Drupal.viewsUi.addItemForm.prototype.refreshCheckedItems = function() {
+Drupal.viewsUi.addItemForm.prototype.refreshCheckedItems = function () {
"use strict";
@@ -283,7 +283,7 @@ Drupal.behaviors.viewsUiRenderAddViewButton.attach = function (context, settings
$addDisplayDropdown.appendTo($menu);
// Add the click handler for the add display button
- $('li.add > a', $menu).bind('click', function (event) {
+ $('li.add > a', $menu).on('click', function (event) {
event.preventDefault();
var $trigger = $(this);
Drupal.behaviors.viewsUiRenderAddViewButton.toggleMenu($trigger);
@@ -346,14 +346,14 @@ Drupal.viewsUi.OptionsSearch = function ($form) {
this.$form = $form;
// Add a keyup handler to the search box.
this.$searchBox = this.$form.find('#edit-override-controls-options-search');
- this.$searchBox.keyup(jQuery.proxy(this.handleKeyup, this));
+ this.$searchBox.on('keyup', jQuery.proxy(this.handleKeyup, this));
// Get a list of option labels and their corresponding divs and maintain it
// in memory, so we have as little overhead as possible at keyup time.
this.options = this.getOptions(this.$form.find('.filterable-option'));
// Restripe on initial loading.
this.handleKeyup();
// Trap the ENTER key in the search box so that it doesn't submit the form.
- this.$searchBox.keypress(function(event) {
+ this.$searchBox.on('keypress', function (event) {
if (event.which === 13) {
event.preventDefault();
}
@@ -463,7 +463,7 @@ Drupal.behaviors.viewsUiPreview.attach = function (context, settings) {
// Executes an initial preview.
if ($('#edit-displays-live-preview').once('edit-displays-live-preview').is(':checked')) {
- $('#preview-submit').once('edit-displays-live-preview').click();
+ $('#preview-submit').once('edit-displays-live-preview').trigger('click');
}
};
@@ -529,7 +529,7 @@ Drupal.viewsUi.rearrangeFilterHandler = function (table, operator) {
this.redrawOperatorLabels();
$('.views-group-title select', table)
.once('views-rearrange-filter-handler')
- .bind('change.views-rearrange-filter-handler', $.proxy(this, 'redrawOperatorLabels'));
+ .on('change.views-rearrange-filter-handler', $.proxy(this, 'redrawOperatorLabels'));
// Bind handlers so that when a "Remove" link is clicked, we:
// - Update the rowspans of cells containing an operator dropdown (since they
@@ -539,8 +539,8 @@ Drupal.viewsUi.rearrangeFilterHandler = function (table, operator) {
// have a label display next to it).
$('a.views-groups-remove-link', this.table)
.once('views-rearrange-filter-handler')
- .bind('click.views-rearrange-filter-handler', $.proxy(this, 'updateRowspans'))
- .bind('click.views-rearrange-filter-handler', $.proxy(this, 'redrawOperatorLabels'));
+ .on('click.views-rearrange-filter-handler', $.proxy(this, 'updateRowspans'))
+ .on('click.views-rearrange-filter-handler', $.proxy(this, 'redrawOperatorLabels'));
};
/**
@@ -561,7 +561,7 @@ Drupal.viewsUi.rearrangeFilterHandler.prototype.insertAddRemoveFilterGroupLinks
// When the link is clicked, dynamically click the hidden form button for
// adding a new filter group.
.once('views-rearrange-filter-handler')
- .bind('click.views-rearrange-filter-handler', $.proxy(this, 'clickAddGroupButton'));
+ .on('click.views-rearrange-filter-handler', $.proxy(this, 'clickAddGroupButton'));
// Find each (visually hidden) button for removing a filter group and insert
// a link next to it.
@@ -575,7 +575,7 @@ Drupal.viewsUi.rearrangeFilterHandler.prototype.insertAddRemoveFilterGroupLinks
// When the link is clicked, dynamically click the corresponding form
// button.
.once('views-rearrange-filter-handler')
- .bind('click.views-rearrange-filter-handler', {buttonId: buttonId}, $.proxy(this, 'clickRemoveGroupButton'));
+ .on('click.views-rearrange-filter-handler', {buttonId: buttonId}, $.proxy(this, 'clickRemoveGroupButton'));
}
};
@@ -588,9 +588,9 @@ Drupal.viewsUi.rearrangeFilterHandler.prototype.clickAddGroupButton = function (
// Due to conflicts between Drupal core's AJAX system and the Views AJAX
// system, the only way to get this to work seems to be to trigger both the
- // .mousedown() and .submit() events.
- this.addGroupButton.mousedown();
- this.addGroupButton.submit();
+ // mousedown and submit events.
+ this.addGroupButton.trigger('mousedown');
+ this.addGroupButton.trigger('submit');
event.preventDefault();
};
@@ -605,10 +605,10 @@ Drupal.viewsUi.rearrangeFilterHandler.prototype.clickRemoveGroupButton = functio
"use strict";
- // For some reason, here we only need to trigger .submit(), unlike for
+ // For some reason, here we only need to trigger submit event, unlike for
// Drupal.viewsUi.rearrangeFilterHandler.prototype.clickAddGroupButton()
- // where we had to trigger .mousedown() also.
- jQuery('input#' + event.data.buttonId, this.table).submit();
+ // where we had to trigger mousedown event also.
+ jQuery('input#' + event.data.buttonId, this.table).trigger('submit');
event.preventDefault();
};
@@ -667,7 +667,7 @@ Drupal.viewsUi.rearrangeFilterHandler.prototype.syncGroupsOperators = function (
return;
}
- this.dropdowns.change(jQuery.proxy(this, 'operatorChangeHandler'));
+ this.dropdowns.on('change', jQuery.proxy(this, 'operatorChangeHandler'));
};
/**
@@ -848,7 +848,7 @@ Drupal.behaviors.viewsFilterConfigSelectAll = {};
/**
* Add a select all checkbox, which checks each checkbox at once.
*/
-Drupal.behaviors.viewsFilterConfigSelectAll.attach = function(context) {
+Drupal.behaviors.viewsFilterConfigSelectAll.attach = function (context) {
"use strict";
@@ -858,7 +858,7 @@ Drupal.behaviors.viewsFilterConfigSelectAll.attach = function(context) {
$(this).show();
})
.find('input[type=checkbox]')
- .click(function() {
+ .on('click', function () {
var checked = $(this).is(':checked');
// Update all checkbox beside the select all checkbox.
$(this).parents('.form-checkboxes').find('input[type=checkbox]').each(function() {
@@ -867,7 +867,7 @@ Drupal.behaviors.viewsFilterConfigSelectAll.attach = function(context) {
});
// Uncheck the select all checkbox if any of the others are unchecked.
$('#views-ui-config-item-form div.form-type-checkbox').not($('.form-item-options-value-all')).find('input[type=checkbox]').each(function() {
- $(this).click(function() {
+ $(this).('click', function () {
if ($(this).is('checked') === false) {
$('#edit-options-value-all').prop('checked', false);
}
@@ -928,7 +928,7 @@ Drupal.behaviors.viewsUiChangeDefaultWidget.attach = function (context, settings
}
}
// Update on widget change.
- $('input[name="options[group_info][multiple]"]').change(function() {
+ $('input[name="options[group_info][multiple]"]').on('change', function () {
change_default_widget($(this).attr("checked"));
});
// Update the first time the form is rendered.
@@ -953,7 +953,7 @@ Drupal.viewsUi.Checkboxifier = function (button) {
this.$button.hide();
this.$parent.find('.exposed-description, .grouped-description').hide();
- this.$input.click($.proxy(this, 'clickHandler'));
+ this.$input.on('click', $.proxy(this, 'clickHandler'));
};
@@ -964,8 +964,8 @@ Drupal.viewsUi.Checkboxifier.prototype.clickHandler = function (e) {
"use strict";
- this.$button.mousedown();
- this.$button.submit();
+ this.$button.trigger('mousedown');
+ this.$button.trigger('submit');
};
/**
@@ -983,12 +983,12 @@ Drupal.behaviors.viewsUiOverrideSelect.attach = function (context, settings) {
var old_value = $submit.val();
$submit.once('views-ui-override-button-text')
- .bind('mouseup', function() {
+ .on('mouseup', function () {
$(this).val(old_value);
return true;
});
- $(this).bind('change', function() {
+ $(this).on('change', function () {
if ($(this).val() === 'default') {
$submit.val(Drupal.t('Apply (all displays)'));
}
@@ -1099,12 +1099,12 @@ Drupal.viewsUi.resizeModal = function (e, no_shrink) {
};
Drupal.behaviors.viewsUiHandlerRemoveLink = {};
-Drupal.behaviors.viewsUiHandlerRemoveLink.attach = function(context) {
+Drupal.behaviors.viewsUiHandlerRemoveLink.attach = function (context) {
var $ = jQuery;
// Handle handler deletion by looking for the hidden checkbox and hiding the
// row.
- $('a.views-remove-link', context).once('views-processed').click(function(event) {
+ $('a.views-remove-link', context).once('views-processed').on('click', function (event) {
var id = $(this).attr('id').replace('views-remove-link-', '');
$('#views-row-' + id, context).hide();
$('#views-removed-' + id, context).attr('checked', true);
@@ -1113,7 +1113,7 @@ Drupal.behaviors.viewsUiHandlerRemoveLink.attach = function(context) {
// Handle display deletion by looking for the hidden checkbox and hiding the
// row.
- $('a.display-remove-link', context).once('display').click(function(event) {
+ $('a.display-remove-link', context).once('display').on('click', function (event) {
var id = $(this).attr('id').replace('display-remove-link-', '');
$('#display-row-' + id, context).hide();
$('#display-removed-' + id, context).attr('checked', true);
@@ -1126,6 +1126,6 @@ jQuery(function() {
"use strict"
- jQuery(window).bind('resize', Drupal.viewsUi.resizeModal);
- jQuery(window).bind('scroll', Drupal.viewsUi.resizeModal);
+ jQuery(window).on('resize', Drupal.viewsUi.resizeModal);
+ jQuery(window).on('scroll', Drupal.viewsUi.resizeModal);
});