diff -u b/core/misc/ajax.es6.js b/core/misc/ajax.es6.js --- b/core/misc/ajax.es6.js +++ b/core/misc/ajax.es6.js @@ -1036,24 +1036,8 @@ // Apply any settings from the returned JSON if available. const settings = response.settings || ajax.settings || drupalSettings; - // Store SVG elements - const svgStorage = {}; - // Parse response.data into an element collection. - const $newContent = $($.parseHTML(response.data, true).map((element) => { - // If the response contains an SVG, replace it with a placeholder. - if (element.nodeName && element.nodeName === 'svg') { - // Create an ID to reference later. - const hash = `svg-${Math.random().toString(36).substring(7)}`; - svgStorage[hash] = element.outerHTML; - - // Create a plceholder DIV that will be replaced with the SVG. - const svgPlaceHolder = document.createElement('div'); - svgPlaceHolder.id = hash; - return svgPlaceHolder; - } - return element; - })); + const $newContent = $('
').html(response.data).contents(); // If removing content from the wrapper, detach behaviors first. switch (method) { @@ -1071,14 +1055,6 @@ // Add the new content to the page. $wrapper[method]($newContent); - // If there is any SVG data, start replacing them. - if (Object.keys(svgStorage).length) { - Object.keys(svgStorage).forEach((key) => { - // Replace each placeholder DIV with the saved SVG data. - $(`#${key}`).replaceWith(svgStorage[key]); - }); - } - // Immediately hide the new content if we're using any effects. if (effect.showEffect !== 'show') { $newContent.hide(); diff -u b/core/misc/ajax.js b/core/misc/ajax.js --- b/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -487,19 +487,7 @@ var settings = response.settings || ajax.settings || drupalSettings; - var svgStorage = {}; - - var $newContent = $($.parseHTML(response.data, true).map(function (element) { - if (element.nodeName && element.nodeName === 'svg') { - var hash = 'svg-' + Math.random().toString(36).substring(7); - svgStorage[hash] = element.outerHTML; - - var svgPlaceHolder = document.createElement('div'); - svgPlaceHolder.id = hash; - return svgPlaceHolder; - } - return element; - })); + var $newContent = $('').html(response.data).contents(); switch (method) { case 'html': @@ -515,12 +503,6 @@ $wrapper[method]($newContent); - if (Object.keys(svgStorage).length) { - Object.keys(svgStorage).forEach(function (key) { - $('#' + key).replaceWith(svgStorage[key]); - }); - } - if (effect.showEffect !== 'show') { $newContent.hide(); }