diff options
Diffstat (limited to 'core/misc/ajax.js')
-rw-r--r-- | core/misc/ajax.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/core/misc/ajax.js b/core/misc/ajax.js index a9ce2cf3fcd..d7c776a7065 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -1337,14 +1337,16 @@ // 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')); + // Create a temporary template element. + const template = fragment.appendChild( + document.createElement('template'), + ); - // Set the innerHTML of the div to the provided HTML string - tempDiv.innerHTML = htmlString; + // Set the innerHTML of the template to the provided HTML string. + template.innerHTML = htmlString; - // Return the contents of the temporary div - return tempDiv.childNodes; + // Return the contents of the temporary template. + return template.content.childNodes; }; let $newContent = $(parseHTML(response.data)); |