diff --git a/core/misc/ajax.js b/core/misc/ajax.js
index 94bfb89..5c3e9df 100644
--- a/core/misc/ajax.js
+++ b/core/misc/ajax.js
@@ -174,7 +174,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);
});
@@ -191,7 +191,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);
}
};
@@ -224,7 +224,7 @@ Drupal.ajax.prototype.keypressResponse = function (element, event) {
*
* When an event that triggers an Ajax response happens, this method will
* perform the actual Ajax call. It is bound to the event using
- * bind() in the constructor, and it uses the options specified on the
+ * on() in the constructor, and it uses the options specified on the
* ajax object.
*/
Drupal.ajax.prototype.eventResponse = function (element, event) {
diff --git a/core/misc/autocomplete.js b/core/misc/autocomplete.js
index dc58b19..062b8ae 100644
--- a/core/misc/autocomplete.js
+++ b/core/misc/autocomplete.js
@@ -48,10 +48,11 @@ Drupal.jsAC = function ($input, db) {
this.ariaLive = $('#' + this.input.id + '-autocomplete-aria-live');
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(); });
+ $input.on({
+ 'keydown': function (event) { return ac.onkeydown(this, event); },
+ 'keyup': function (event) { ac.onkeyup(this, event); },
+ 'blur': function () { ac.hidePopup(); ac.db.cancel(); }
+ });
};
/**
@@ -223,13 +224,14 @@ Drupal.jsAC.prototype.found = function (matches) {
// Prepare matches.
var ul = $('
');
var ac = this;
+ ul.on({
+ 'mousedown': function () { ac.select(this); },
+ 'mouseover': function () { ac.highlight(this); },
+ 'mouseout': function () { ac.unhighlight(this); }
+ }, 'li');
for (var key in matches) {
if (matches.hasOwnProperty(key)) {
- $('')
- .html($('').html(matches[key]))
- .mousedown(function () { ac.select(this); })
- .mouseover(function () { ac.highlight(this); })
- .mouseout(function () { ac.unhighlight(this); })
+ $('
' + matches[key] + '
')
.data('autocompleteValue', key)
.appendTo(ul);
}
diff --git a/core/misc/collapse.js b/core/misc/collapse.js
index d456a25..0f8cf24 100644
--- a/core/misc/collapse.js
+++ b/core/misc/collapse.js
@@ -50,7 +50,7 @@ $.extend(CollapsibleFieldset.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(CollapsibleFieldset.prototype, {
var $link = $('')
.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 d75de97..ed4ebb5 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').andSelf().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 a7ba0f7..e231aa9 100644
--- a/core/misc/machine-name.js
+++ b/core/misc/machine-name.js
@@ -1,3 +1,9 @@
+ var $link = $('' + Drupal.t('Edit') + '')
+ .on('click', function () {
+ $suffix.hide();
+ $source.off('.machineName');
+ if ($target.val() == '') {
+ $source.on('keyup.machineName change.machineName', function () {
(function ($) {
"use strict";
diff --git a/core/misc/states.js b/core/misc/states.js
index e92869f..1051df3 100644
--- a/core/misc/states.js
+++ b/core/misc/states.js
@@ -118,7 +118,9 @@ 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, $.proxy(function (e) {
+ this.update(selector, state, e.value);
+ }, this));
// Make sure the event we just bound ourselves to is actually fired.
new states.Trigger({ selector: selector, state: state });
@@ -348,7 +350,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) {
@@ -498,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) {
@@ -512,33 +514,32 @@ $(document).bind('state:disabled', function(e) {
}
});
-$(document).bind('state:required', function(e) {
- if (e.trigger) {
- if (e.value) {
- $(e.target).closest('.form-item, .form-wrapper').find('label').append('*');
+$(document).on({
+ 'state:required': function(e) {
+ if (e.trigger) {
+ if (e.value) {
+ $(e.target).closest('.form-item, .form-wrapper').find('label').append('*');
+ }
+ else {
+ $(e.target).closest('.form-item, .form-wrapper').find('label .form-required').remove();
+ }
}
- else {
- $(e.target).closest('.form-item, .form-wrapper').find('label .form-required').remove();
+ },
+ 'state:visible': function(e) {
+ if (e.trigger) {
+ $(e.target).closest('.form-item, .form-submit, .form-wrapper').toggle(e.value);
}
- }
-});
-
-$(document).bind('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) {
- if (e.trigger) {
- $(e.target).attr('checked', e.value);
- }
-});
-
-$(document).bind('state:collapsed', function(e) {
- if (e.trigger) {
- if ($(e.target).is('.collapsed') !== e.value) {
- $(e.target).find('> legend a').click();
+ },
+ 'state:checked': function(e) {
+ if (e.trigger) {
+ $(e.target).attr('checked', e.value);
+ }
+ },
+ 'state:collapsed': function(e) {
+ if (e.trigger) {
+ if ($(e.target).is('.collapsed') !== e.value) {
+ $(e.target).find('> legend a').trigger('click');
+ }
}
}
});
diff --git a/core/misc/tabledrag.js b/core/misc/tabledrag.js
index 1e2b6cc..7b95c66 100644
--- a/core/misc/tabledrag.js
+++ b/core/misc/tabledrag.js
@@ -95,7 +95,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))
@@ -111,8 +111,10 @@ Drupal.tableDrag = function (table, tableSettings) {
// Add mouse bindings to the document. The self variable is passed along
// as event handlers do not have direct access to the tableDrag object.
- $(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); },
+ 'mouseup': function (event) { return self.dropRow(event, self); }
+ });
// React to localStorage event showing or hiding weight columns.
$(window).bind('storage', $.proxy(function (e) {
// Only react to 'Drupal.tableDrag.showWeight' value change.
diff --git a/core/misc/tableheader.js b/core/misc/tableheader.js
index 364cad2..ead41f8 100644
--- a/core/misc/tableheader.js
+++ b/core/misc/tableheader.js
@@ -101,7 +101,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', 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 36af864..02d13c0 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: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:checkbox:enabled').click(function (e) {
+ checkboxes = $table.find('td input: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 eaf73db..9048f98 100644
--- a/core/misc/vertical-tabs.js
+++ b/core/misc/vertical-tabs.js
@@ -80,24 +80,25 @@ Drupal.verticalTab = function (settings) {
var self = this;
$.extend(this, settings, Drupal.theme('verticalTab', settings));
- this.link.click(function (e) {
- e.preventDefault();
- self.focus();
- });
-
- // Keyboard events added:
- // Pressing the Enter key will open the tab pane.
- this.link.keydown(function(event) {
- event.preventDefault();
- if (event.keyCode === 13) {
+ this.link.on({
+ 'click': function () {
self.focus();
- // Set focus on the first input field of the visible fieldset/tab pane.
- $("fieldset.vertical-tabs-pane :input:visible:enabled:first").focus();
+ return false;
+ },
+ // Keyboard events added:
+ // Pressing the Enter key will open the tab pane.
+ 'keydown': function (event) {
+ if (event.keyCode == 13) {
+ self.focus();
+ // Set focus on the first input field of the visible fieldset/tab pane.
+ $("fieldset.vertical-tabs-pane :input:visible:enabled:first").focus();
+ return false;
+ }
}
});
this.fieldset
- .bind('summaryUpdated', function () {
+ .on('summaryUpdated', function () {
self.updateSummary();
})
.trigger('summaryUpdated');
@@ -166,7 +167,7 @@ Drupal.verticalTab.prototype = {
// Focus the first visible tab (if there is one).
var $firstTab = this.fieldset.siblings('.vertical-tabs-pane:not(.vertical-tab-hidden):first');
if ($firstTab.length) {
- $firstTab.data('verticalTab').focus();
+ $firstTab.data('verticalTab').trigger('focus');
}
return this;
}
diff --git a/core/modules/color/color.js b/core/modules/color/color.js
index 014ea2b..5259062 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.
@@ -185,7 +185,8 @@ Drupal.behaviors.color = {
// Remove old bindings.
if (focused) {
$(focused).unbind('keyup', farb.updateValue)
- .unbind('keyup', preview).unbind('keyup', resetScheme)
+ focused && $(focused).off('keyup', farb.updateValue)
+ .off('keyup', preview).off('keyup', resetScheme)
.parent().removeClass('item-selected');
}
@@ -193,7 +194,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');
}
@@ -242,7 +243,7 @@ Drupal.behaviors.color = {
this.i = i;
inputs.push(this);
})
- .focus(focus);
+ .on('focus', focus);
form.find('#palette label');
diff --git a/core/modules/contextual/contextual.js b/core/modules/contextual/contextual.js
index 27a2fa7..317c38e 100644
--- a/core/modules/contextual/contextual.js
+++ b/core/modules/contextual/contextual.js
@@ -18,24 +18,23 @@ Drupal.behaviors.contextualLinks = {
var $wrapper = $(this);
var $region = $wrapper.closest('.contextual-region');
var $links = $wrapper.find('ul');
- var $trigger = $('').text(Drupal.t('Configure')).click(
- function (e) {
- e.preventDefault();
+ var $trigger = $('').text(Drupal.t('Configure'));
+ // Attach hover behavior to trigger and ul.contextual-links.
+ $trigger.add($links).hover({
+ 'click': function () {
$links.stop(true, true).slideToggle(100);
$wrapper.toggleClass('contextual-active');
- }
- );
- // Attach hover behavior to trigger and ul.contextual-links.
- $trigger.add($links).hover(
- function () { $region.addClass('contextual-region-active'); },
- function () { $region.removeClass('contextual-region-active'); }
- );
+ return false;
+ },
+ 'mouseenter': function () { $region.addClass('contextual-region-active'); },
+ 'mouseleave': function () { $region.removeClass('contextual-region-active'); }
+ });
// Hide the contextual links when user clicks a link or rolls out of the .contextual-region.
- $region.bind('mouseleave click', Drupal.contextualLinks.mouseleave);
- $region.hover(
- function() { $trigger.addClass('contextual-links-trigger-active'); },
- function() { $trigger.removeClass('contextual-links-trigger-active'); }
- );
+ $region.on({
+ 'mouseleave click': Drupal.contextualLinks.mouseleave,
+ 'mouseenter': function() { $trigger.addClass('contextual-links-trigger-active'); },
+ 'mouseleave': function() { $trigger.removeClass('contextual-links-trigger-active'); }
+ });
// Prepend the trigger.
$wrapper.prepend($trigger);
});
diff --git a/core/modules/field_ui/field_ui.js b/core/modules/field_ui/field_ui.js
index e49f07b..3c452f7 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);
diff --git a/core/modules/file/file.js b/core/modules/file/file.js
index ad147d1..6e07367 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.on('change', selector, {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.off('change', selector, 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 b002041..63c108c 100644
--- a/core/modules/filter/filter.admin.js
+++ b/core/modules/filter/filter.admin.js
@@ -14,7 +14,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 9482737..993fc86 100644
--- a/core/modules/filter/filter.js
+++ b/core/modules/filter/filter.js
@@ -10,12 +10,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.admin.js b/core/modules/menu/menu.admin.js
index 6f2bb45..cc8308d 100644
--- a/core/modules/menu/menu.admin.js
+++ b/core/modules/menu/menu.admin.js
@@ -4,11 +4,9 @@
Drupal.behaviors.menuChangeParentItems = {
attach: function (context, settings) {
- $('fieldset#edit-menu input').each(function () {
- $(this).change(function () {
- // Update list of available parent menu items.
- Drupal.menu_update_parent_list();
- });
+ $('#edit-menu').on('change', 'input', function () {
+ // Update list of available parent menu items.
+ Drupal.menu_update_parent_list();
});
}
};
diff --git a/core/modules/menu/menu.js b/core/modules/menu/menu.js
index f3bfb1c..61e91c3 100644
--- a/core/modules/menu/menu.js
+++ b/core/modules/menu/menu.js
@@ -39,11 +39,11 @@ 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).
- $checkbox.change(function () {
+ $checkbox.on('change', function () {
if ($checkbox.is(':checked')) {
if (!$link_title.data('menuLinkAutomaticTitleOveridden')) {
$link_title.val($title.val());
@@ -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 ec7cc15..2c0f3f4 100644
--- a/core/modules/openid/openid.js
+++ b/core/modules/openid/openid.js
@@ -25,7 +25,7 @@ Drupal.behaviors.openid = {
$context.find('li.openid-link')
.once('openid')
- .click(function (e) {
+ .on('click', function () {
e.preventDefault();
loginElements.hide();
openidElements.css('display', 'block');
@@ -37,7 +37,7 @@ Drupal.behaviors.openid = {
});
$context.find('li.user-link')
.once('openid')
- .click(function (e) {
+ .on('click', function () {
e.preventDefault();
openidElements.hide();
loginElements.css('display', 'block');
diff --git a/core/modules/overlay/overlay-child.js b/core/modules/overlay/overlay-child.js
index e1f8ff1..1d17880 100644
--- a/core/modules/overlay/overlay-child.js
+++ b/core/modules/overlay/overlay-child.js
@@ -102,7 +102,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'));
};
/**
@@ -135,7 +135,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);
var id = setInterval(function () {
dots = (dots.length > 10) ? '' : dots + '.';
@@ -150,7 +150,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');
@@ -169,7 +169,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 fa726dc..66f10da 100644
--- a/core/modules/overlay/overlay-parent.js
+++ b/core/modules/overlay/overlay-parent.js
@@ -18,7 +18,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');
@@ -34,7 +34,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'));
}
};
@@ -117,27 +117,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('drupalOverlayLoad' + eventClass, $.proxy(this, 'eventhandlerOuterResize'))
- .bind('drupalOverlayReady' + eventClass +
+ .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'));
if ($('.overlay-displace-top, .overlay-displace-bottom').length) {
$(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'));
}
};
@@ -214,7 +214,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/simpletest/simpletest.js b/core/modules/simpletest/simpletest.js
index 7048966..4c597fc 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);
diff --git a/core/modules/system/system.js b/core/modules/system/system.js
index 66fd4f5..9ab0716 100644
--- a/core/modules/system/system.js
+++ b/core/modules/system/system.js
@@ -29,7 +29,7 @@ Drupal.hideEmailAdministratorCheckbox = function () {
Drupal.behaviors.copyFieldValue = {
attach: function (context, settings) {
for (var sourceId in settings.copyFieldValue) {
- $('#' + sourceId, context).once('copy-field-values').bind('blur', function () {
+ $('#' + sourceId, context).once('copy-field-values').on('blur', function () {
// Get the list of target fields.
var targetIds = settings.copyFieldValue[sourceId];
// Add the behavior to update target fields on blur of the primary field.
@@ -76,15 +76,15 @@ Drupal.behaviors.dateTime = {
Drupal.behaviors.pageCache = {
attach: function (context, settings) {
var $context = $(context);
- $context.find('#edit-cache-0').change(function () {
+ $context.find('#edit-cache-0').on('change', function () {
$('#page-compression-wrapper').hide();
$('#cache-error').hide();
});
- $context.find('#edit-cache-1').change(function () {
+ $context.find('#edit-cache-1').on('change', function () {
$('#page-compression-wrapper').show();
$('#cache-error').hide();
});
- $context.find('#edit-cache-2').change(function () {
+ $context.find('#edit-cache-2').on('change', function () {
$('#page-compression-wrapper').show();
$('#cache-error').show();
});
diff --git a/core/modules/toolbar/toolbar.js b/core/modules/toolbar/toolbar.js
index 2353050..aac0db4 100644
--- a/core/modules/toolbar/toolbar.js
+++ b/core/modules/toolbar/toolbar.js
@@ -18,7 +18,7 @@ Drupal.behaviors.toolbar = {
$(window).on('resize.toolbar', Drupal.toolbar.height);
// Toggling toolbar drawer.
- $toolbar.find('a.toggle').once('toolbar-toggle').click(function(e) {
+ $toolbar.find('a.toggle').once('toolbar-toggle').on('click', function(e) {
e.preventDefault();
Drupal.toolbar.toggle();
// Allow resize event handlers to recalculate sizes/positions.
diff --git a/core/modules/translation/translation.js b/core/modules/translation/translation.js
index ad3350a..7ce73d2 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').attr('checked')) {
diff --git a/core/modules/user/user.js b/core/modules/user/user.js
index 8e0e135..948d3d4 100644
--- a/core/modules/user/user.js
+++ b/core/modules/user/user.js
@@ -85,8 +85,8 @@ Drupal.behaviors.password = {
// Monitor keyup and blur events.
// Blur must be used because a mouse paste does not trigger keyup.
- passwordInput.keyup(passwordCheck).focus(passwordCheck).blur(passwordCheck);
- confirmInput.keyup(passwordCheckMatch).blur(passwordCheckMatch);
+ passwordInput.on('keyup focus blur', passwordCheck);
+ confirmInput.on('keyup blur', passwordCheckMatch);
});
}
};
@@ -190,7 +190,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).attr('checked')) {
$checkbox.attr('checked', true);
}
diff --git a/core/modules/user/user.permissions.js b/core/modules/user/user.permissions.js
index 15658a9..e27526f 100644
--- a/core/modules/user/user.permissions.js
+++ b/core/modules/user/user.permissions.js
@@ -40,8 +40,7 @@ Drupal.behaviors.permissions = {
});
// Initialize the authenticated user checkbox.
- $table.find('input[type=checkbox].rid-authenticated')
- .bind('click.permissions', self.toggle)
+ $table.on('click.permissions', 'input[type=checkbox].rid-authenticated', self.toggle)
// .triggerHandler() cannot be used here, as it only affects the first
// element.
.each(self.toggle);