Change in Drupal core AJAX is breaking View Infinite Scroll pager

Created on 24 August 2025, about 2 months ago

Problem/Motivation

While on Drupal 10.5.1 the pager works fine, without any AJAX errors. After update to Drupal 10.5.2 manually clicking the pager (haven't tested with automated option, but I think it will be the same), the pager's code causes AJAX error.

Steps to reproduce

  • Update Drupal Core to 10.5.2
  • Click "load more" on infinite scroll pager
  • It will trigger "An error occurred during the execution of the Ajax response: TypeError: Cannot read properties of null (reading 'contains')"

Looks like the breaking change is in ajax.js file (around lines 1335+):

from

      // Parse response.data into an element collection.
      const parseHTML = (htmlString) => {
        const fragment = document.createDocumentFragment();
        // Create a temporary div element
        const tempDiv = fragment.appendChild(document.createElement('div'));

        // Set the innerHTML of the div to the provided HTML string
        tempDiv.innerHTML = htmlString;

        // Return the contents of the temporary div
        return tempDiv.childNodes;
      };

to this:

      // Parse response.data into an element collection.
      const parseHTML = (htmlString) => {
        const fragment = document.createDocumentFragment();
        // Create a temporary template element.
        const template = fragment.appendChild(
          document.createElement('template'),
        );

        // Set the innerHTML of the template to the provided HTML string.
        template.innerHTML = htmlString;

        // Return the contents of the temporary template.
        return template.content.childNodes;
      };
πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States veronicaSeveryn

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024