The majority of the patch was made thanks to a custom codemod, automated replacement are:
Before | After |
---|
$('body')
.once('detailsAria')
.on('click.detailsAria', function () {});
| $(once('detailsAria', 'body'))
.on('click.detailsAria', function () {});
|
const $collapsibleDetails = $(context)
.find('details')
.once('collapse')
.addClass('collapse-processed');
| const $collapsibleDetails = $(once('collapse', 'details', context))
.addClass('collapse-processed');
|
const $progress = $('[data-drupal-progress]').once('batch');
| const $progress = $(once('batch', '[data-drupal-progress]'));
|
$(context)
.find('th.select-all')
.closest('table')
.once('table-select')
.each(Drupal.tableSelect);
| $(once('table-select', $(context)
.find('th.select-all')
.closest('table')))
.each(Drupal.tableSelect);
|
const $timezone = $(context).find('.timezone-detect').once('timezone');
| const $timezone = $(once('timezone', '.timezone-detect', context));
|
$(this).removeOnce('big-pipe');
| $(once.remove('big-pipe', $(this)));
|
const $configurationForm = $(context)
.find('.ckeditor-toolbar-configuration')
.findOnce('ckeditor-configuration');
| const $configurationForm = $(
once.filter('ckeditor-configuration', '.ckeditor-toolbar-configuration', context)
);
|
$('<div class="color-placeholder"></div>').once('color').prependTo(form);
| $(once('color', $('<div class="color-placeholder"></div>'))).prependTo(form);
|
$('.color-preview')
.once('color')
.append(`<div id="gradient-${i}"></div>`);
| $(once('color', '.color-preview'))
.append(`<div id="gradient-${i}"></div>`);
|
if ($('body').once('contextualToolbar-init').length) {
initContextualToolbar(context);
}
| if ($(once('contextualToolbar-init', 'body')).length) {
initContextualToolbar(context);
}
|
$context
.find('#filters-status-wrapper input.form-checkbox')
.once('filter-editor-status')
.each(function () {});
| $(once(
'filter-editor-status',
'#filters-status-wrapper input.form-checkbox',
context
))
.each(function () {});
|
editors = $(context).find('[data-editor-for]').findOnce('editor');
editors = $(context).find('[data-editor-for]').removeOnce('editor');
| editors = $(once.filter('editor', '[data-editor-for]', context));
editors = $(once.remove('editor', '[data-editor-for]', context));
|
$context
.find(selector)
.removeOnce('fileValidate')
.off('change.fileValidate', Drupal.file.validateExtension);
| $(once.remove('fileValidate', $context
.find(selector)))
.off('change.fileValidate', Drupal.file.validateExtension);
|
$(context)
.find('.js-filter-guidelines')
.once('filter-guidelines')
.find(':header')
.hide()
.closest('.js-filter-wrapper')
.find('select.js-filter-list')
.on('change.filterGuidelines', updateFilterGuidelines)
// Need to trigger the namespaced event to avoid triggering formUpdated
// when initializing the select.
.trigger('change.filterGuidelines');
| $(once('filter-guidelines', '.js-filter-guidelines', context))
.find(':header')
.hide()
.closest('.js-filter-wrapper')
.find('select.js-filter-list')
.on('change.filterGuidelines', updateFilterGuidelines)
// Need to trigger the namespaced event to avoid triggering formUpdated
// when initializing the select.
.trigger('change.filterGuidelines');
|
// Keep the jQuery find because of sizzle selector.
$(context)
.find('table .bundle-settings .translatable :input')
.once('translation-entity-admin-hide')
.each(function () {});
| // Keep the jQuery find because of sizzle selector.
$(once('translation-entity-admin-hide', $(context)
.find('table .bundle-settings .translatable :input')))
.each(function () {});
|
$('.js-click-to-select-trigger', context)
.once('media-library-click-to-select')
.on('click', (event) => {});
| $(
once('media-library-click-to-select', '.js-click-to-select-trigger', context)
)
.on('click', (event) => {});
|
const $view = $(
'.js-media-library-view[data-view-display-id="page"]',
context,
).once('media-library-select-all');
| const $view = $(once(
'media-library-select-all',
'.js-media-library-view[data-view-display-id="page"]',
context
));
|
$('.js-media-library-item-weight', context)
.once('media-library-toggle')
.parent()
.hide();
| $(once('media-library-toggle', '.js-media-library-item-weight', context))
.parent()
.hide();
|
$('body').removeOnce('copy-field-values').off('value:copy');
| $(once.remove('copy-field-values', 'body')).off('value:copy');
|
$(`#${ids.join(', #')}`)
.removeOnce('copy-field-values')
.off('blur');
| $(once.remove('copy-field-values', `#${ids.join(', #')}`))
.off('blur');
|
this.$el
.find(`#toolbar-link-${id}`)
.once('toolbar-subtrees')
.after(subtrees[id]);
| $(once('toolbar-subtrees', this.$el
.find(`#toolbar-link-${id}`)))
.after(subtrees[id]);
|
initTableDrag($(context).find(`#${base}`).once('tabledrag'), base);
| initTableDrag($(once('tabledrag', `#${base}`, context)), base);
|
$('table')
.findOnce('tabledrag')
.trigger('columnschange', !!displayWeight);
| $(once.filter('tabledrag', 'table'))
.trigger('columnschange', !!displayWeight);
|
const $forms = (contextIsForm ? $context : $context.find('form')).once('form-updated');
| // Replace
const $forms = $(once('form-updated', contextIsForm ? $context : $context.find('form')));
|
const $source = $context
.find(sourceId)
.addClass('machine-name-source')
.once('machine-name');
| const $source = $(once('machine-name', $context
.find(sourceId)
.addClass('machine-name-source')));
|
// Don't replace.
_.once(() => {});
CKEDITOR.once('instanceReady', (e) => {});
| // Don't replace.
_.once(() => {});
CKEDITOR.once('instanceReady', (e) => {});
|