diff --git a/core/misc/ajax.js b/core/misc/ajax.js
index a586945..ad9dcae 100644
--- a/core/misc/ajax.js
+++ b/core/misc/ajax.js
@@ -258,7 +258,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);
});
@@ -266,7 +266,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);
});
}
@@ -275,7 +275,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 0378b95..c310808 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(); });
};
/**
diff --git a/core/misc/collapse.js b/core/misc/collapse.js
index c26ab55..84a803d 100644
--- a/core/misc/collapse.js
+++ b/core/misc/collapse.js
@@ -40,7 +40,7 @@ $.extend(CollapsibleDetails.prototype, {
setupSummary: function () {
this.$summary = $('');
this.$node
- .bind('summaryUpdated', $.proxy(this.onSummaryUpdated, this))
+ .on('summaryUpdated', $.proxy(this.onSummaryUpdated, this))
.trigger('summaryUpdated');
},
/**
@@ -60,7 +60,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 d934ee5..e8be254 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 57e48a2..f8dc614 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))
@@ -123,16 +123,16 @@ Drupal.tableDrag = function (table, tableSettings) {
// Add event bindings to the document. The self variable is passed along
// as event handlers do not have direct access to the tableDrag object.
if (Modernizr.touch) {
- $(document).bind('touchmove', function (event) { return self.dragRow(event.originalEvent.touches[0], self); });
- $(document).bind('touchend', function (event) { return self.dropRow(event.originalEvent.touches[0], self); });
+ $(document).on('touchmove', function (event) { return self.dragRow(event.originalEvent.touches[0], self); });
+ $(document).on('touchend', function (event) { return self.dropRow(event.originalEvent.touches[0], self); });
}
else {
- $(document).bind('mousemove', function (event) { return self.dragRow(event, self); });
- $(document).bind('mouseup', function (event) { return self.dropRow(event, self); });
+ $(document).on('mousemove', function (event) { return self.dragRow(event, self); });
+ $(document).on('mouseup', function (event) { return self.dropRow(event, self); });
}
// 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.
@@ -504,7 +504,7 @@ Drupal.tableDrag.prototype.dragStart = function (event, self, item) {
// If there's a lingering row object from the keyboard, remove its focus.
if (self.rowObject) {
- $(self.rowObject.element).find('a.tabledrag-handle').blur();
+ $(self.rowObject.element).find('a.tabledrag-handle').trigger('blur');
}
// Create a new rowObject for manipulation of this row.
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 b3ab4c4..da3a722 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 a02fa2c..d45bcac 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 7d41680..9e0735c 100644
--- a/core/modules/ckeditor/js/ckeditor.admin.js
+++ b/core/modules/ckeditor/js/ckeditor.admin.js
@@ -536,7 +536,7 @@ Drupal.ckeditor = {
if (success) {
$group.appendTo($(event.currentTarget).closest('.ckeditor-row').children('.ckeditor-toolbar-groups'));
// Focus on the new group.
- $group.focus();
+ $group.trigger('focus');
}
}
@@ -574,7 +574,7 @@ Drupal.ckeditor = {
* elements involved in the sort action.
*/
startButtonDrag: function (event, ui) {
- this.$el.find('a:focus').blur();
+ this.$el.find('a:focus').trigger('blur');
// Show the button group names as soon as the user starts dragging.
this.model.set('groupNamesVisible', true);
@@ -597,7 +597,7 @@ Drupal.ckeditor = {
}
// Refocus the target button so that the user can continue from a known
// place.
- ui.item.find('a').focus();
+ ui.item.find('a').trigger('focus');
});
},
@@ -809,7 +809,7 @@ Drupal.ckeditor = {
.off()
.remove();
// Focus on the first button in the active toolbar.
- $activeButtons.find('.ckeditor-toolbar-group-buttons').eq(0).children().eq(0).children().focus();
+ $activeButtons.find('.ckeditor-toolbar-group-buttons').eq(0).children().eq(0).children().trigger('focus');
}
// Otherwise, move it.
else {
@@ -852,7 +852,7 @@ Drupal.ckeditor = {
}
// Refocus the target button so that the user can continue from a known
// place.
- $target.focus();
+ $target.trigger('focus');
});
event.preventDefault();
@@ -933,7 +933,7 @@ Drupal.ckeditor = {
}
registerGroupMove(this, $group);
- $group.focus();
+ $group.trigger('focus');
event.preventDefault();
event.stopPropagation();
}
@@ -1410,7 +1410,7 @@ function openGroupNameDialog (view, $group, callback) {
// When editing, set the "group name" input in the form to the current value.
.attr('value', $group.attr('data-drupal-ckeditor-toolbar-group-name'))
// Focus on the "group name" input in the form.
- .focus();
+ .trigger('focus');
}
/**
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 18493d6..c1cdcbc 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 2955bf9..9297462 100644
--- a/core/modules/field_ui/field_ui.js
+++ b/core/modules/field_ui/field_ui.js
@@ -157,7 +157,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.
@@ -190,7 +190,7 @@ Drupal.fieldUIDisplayOverview.field = function (row, data) {
// Attach change listener to the 'plugin type' select.
this.$pluginSelect = $(row).find('select.field-plugin-type');
- this.$pluginSelect.change(Drupal.fieldUIOverview.onChange);
+ this.$pluginSelect.on('change', Drupal.fieldUIOverview.onChange);
return this;
};
diff --git a/core/modules/file/file.js b/core/modules/file/file.js
index df1c3b1..c7c6362 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);
}
}
}
@@ -63,13 +63,13 @@ Drupal.behaviors.fileAutoUpload = {
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);
}
};
@@ -78,10 +78,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 b440fae..cde65a5 100644
--- a/core/modules/filter/filter.admin.js
+++ b/core/modules/filter/filter.admin.js
@@ -20,7 +20,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 (filterSettingsTab) {
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/overlay/overlay-child.js b/core/modules/overlay/overlay-child.js
index cd7cdee..4374e80 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.focusable').removeClass('visually-hidden');
})
- .focusout(function () {
+ .on('focusout', function () {
$(this).removeClass('overlay-disable-message-focused')
.find('a.focusable').addClass('visually-hidden');
});
@@ -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('visually-hidden: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 ae1d5b8..999966c 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 7049358..aa422ed 100644
--- a/core/modules/simpletest/simpletest.js
+++ b/core/modules/simpletest/simpletest.js
@@ -15,7 +15,7 @@ Drupal.behaviors.simpleTestMenuCollapse = {
$this.html(drupalSettings.simpleTest.images[direction]);
// Adds group toggling functionality to arrow images.
- $this.click(function () {
+ $this.on('click', function () {
var trs = $this.closest('tbody').children('.' + drupalSettings.simpleTest[this.id].testClass);
var direction = drupalSettings.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 347b6e8..78a180a 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/user/user.js b/core/modules/user/user.js
index 564cebd..7b1ccfa 100644
--- a/core/modules/user/user.js
+++ b/core/modules/user/user.js
@@ -180,7 +180,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 0b416c9..6afef7a 100644
--- a/core/modules/views_ui/js/ajax.js
+++ b/core/modules/views_ui/js/ajax.js
@@ -51,9 +51,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').on('click', function () {
if ($(this).is(':checked')) {
- $('#preview-submit').click();
+ $('#preview-submit').trigger('click');
}
});
}
@@ -64,13 +64,13 @@
*/
Drupal.behaviors.syncPreviewDisplay = {
attach: function (context) {
- $("#views-tabset a").once('views-ajax-processed').click(function() {
+ $("#views-tabset a").once('views-ajax').on('click', function () {
var href = $(this).attr('href');
// Cut of #views-tabset.
var display_id = href.substr(11);
// Set the form element.
$("#views-live-preview #preview-display-id").val(display_id);
- }).addClass('views-ajax-processed');
+ });
}
};
@@ -82,7 +82,7 @@
'progress': { 'type': 'throbber' }
};
// Bind AJAX behaviors to all items showing the class.
- $('a.views-ajax-link', context).once('views-ajax-processed').each(function () {
+ $('a.views-ajax-link', context).once('views-ajax').each(function () {
var element_settings = base_element_settings;
// Set the URL to go to the anchor.
if ($(this).attr('href')) {
@@ -93,7 +93,7 @@
});
$('div#views-live-preview a')
- .once('views-ajax-processed').each(function () {
+ .once('views-ajax').each(function () {
// We don't bind to links without a URL.
if (!$(this).attr('href')) {
return true;
@@ -117,8 +117,8 @@
// @todo Revisit this after fixing Views UI to display a Preview outside
// of the main Edit form.
$('div#views-live-preview input[type=submit]')
- .once('views-ajax-processed').each(function(event) {
- $(this).click(function () {
+ .once('views-ajax').each(function(event) {
+ $(this).on('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 ee70f1f..c1bf873 100644
--- a/core/modules/views_ui/js/views-admin.js
+++ b/core/modules/views_ui/js/views-admin.js
@@ -307,7 +307,7 @@ 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($.proxy(this.handleKeyup, this));
+ this.$searchBox.on('keyup', $.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'));
@@ -856,7 +856,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'));
};
@@ -864,8 +864,9 @@ Drupal.viewsUi.Checkboxifier = function (button) {
* When the checkbox is checked or unchecked, simulate a button press.
*/
Drupal.viewsUi.Checkboxifier.prototype.clickHandler = function (e) {
- this.$button.mousedown();
- this.$button.submit();
+ this.$button
+ .trigger('mousedown')
+ .trigger('submit');
};
/**