Issue #2897938 by tedbow, drpal: Prevent accessing null elements when operating on ajax instances using the off_canvas renderer

8.5.x
effulgentsia 2017-08-14 14:19:19 -07:00
parent 8972a66f2e
commit b5ec4f1d6d
2 changed files with 2 additions and 2 deletions

View File

@ -216,7 +216,7 @@
Drupal.ajax.instances Drupal.ajax.instances
// If there is an element and the renderer is 'off_canvas' then we want // If there is an element and the renderer is 'off_canvas' then we want
// to add our changes. // to add our changes.
.filter(instance => $(instance.element).attr('data-dialog-renderer') === 'off_canvas') .filter(instance => instance && $(instance.element).attr('data-dialog-renderer') === 'off_canvas')
// Loop through all Ajax instances that use the 'off_canvas' renderer to // Loop through all Ajax instances that use the 'off_canvas' renderer to
// set active editable ID. // set active editable ID.
.forEach((instance) => { .forEach((instance) => {

View File

@ -124,7 +124,7 @@
$(toggleEditSelector).once('outsidein').on('click.outsidein', toggleEditMode); $(toggleEditSelector).once('outsidein').on('click.outsidein', toggleEditMode);
Drupal.ajax.instances.filter(function (instance) { Drupal.ajax.instances.filter(function (instance) {
return $(instance.element).attr('data-dialog-renderer') === 'off_canvas'; return instance && $(instance.element).attr('data-dialog-renderer') === 'off_canvas';
}).forEach(function (instance) { }).forEach(function (instance) {
if (!('dialogOptions' in instance.options.data)) { if (!('dialogOptions' in instance.options.data)) {
instance.options.data.dialogOptions = {}; instance.options.data.dialogOptions = {};