diff --git a/core/misc/ajax.js b/core/misc/ajax.js index 5001554..361e4d8 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -272,7 +272,11 @@ */ Drupal.ajax.expired = function () { return Drupal.ajax.instances.filter(function (instance) { - return instance && instance.element !== false && !document.body.contains(instance.element); + if (instance && !(instance.element instanceof HTMLElement)) { + Drupal.throwError(new Error(Drupal.t('TypeError: instance.element is not a HTMLElement'))); + } + + return instance && instance.element !== false && instance.element instanceof HTMLElement && !document.body.contains(instance.element); }); };