Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When editing a views using the administration UI, ajax callbacks breaks the usability of the views UI.
Issue come from ajax.js:L275 :
Drupal.ajax.expired = function () {
return Drupal.ajax.instances.filter(function (instance) {
return instance && instance.element !== false && !document.body.contains(instance.element);
});
};
Error is :
Uncaught TypeError: Failed to execute 'contains' on 'Node': parameter 1 is not of type 'Node'.
The structure of instance.element is
{
0:body.user-logged-in.path-admin.too....
context:body.user-logged-in.path-admin.too...
length:1
}
Drupal 8.3.2
Php5.6.5 from Wamp64 3.0.6 on Win 10
it is also happening on newly created views.
Proposed resolution
Simply pass the element index.
Drupal.ajax.expired = function () {
return Drupal.ajax.instances.filter(function (instance) {
return instance && instance.element !== false && !document.body.contains(instance.element[0]);
});
};
But I've no idea of possible drawback.
As workaround, simply disabling javascript when views edition is required, shift down the priority of this issue from blocker to major in my projects.
Comments
Comment #2
swingingtom CreditAttribution: swingingtom commentedComment #3
LendudeThanks for the report.
Since this is definitely not happening on all Views editing pages, some additional steps to reproduce might be nice.
Can this be reproduced on a clean Drupal 8 install or do you have any modules enabled that might have an effect here?
Comment #4
swingingtom CreditAttribution: swingingtom commentedI wasn't able to reproduce it on fresh and uptodate environnement.