File tree Expand file tree Collapse file tree
src/StaticCaching/Cachers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -251,6 +251,19 @@ function createMap() {
251251 return map;
252252 }
253253
254+ function replaceElement(el, html) {
255+ const tmp = document.createElement('div');
256+ const fragment = document.createDocumentFragment();
257+
258+ tmp.setHTMLUnsafe(html);
259+
260+ while (tmp.firstChild) {
261+ fragment.appendChild(tmp.firstChild);
262+ }
263+
264+ el.replaceWith(fragment);
265+ }
266+
254267 var map = createMap();
255268
256269 fetch('/!/nocache', {
@@ -267,7 +280,7 @@ function createMap() {
267280
268281 const regions = data.regions;
269282 for (var key in regions) {
270- if (map[key]) map[key].setHTMLUnsafe( regions[key]);
283+ if (map[key]) replaceElement( map[key], regions[key]);
271284 }
272285
273286 for (const input of document.querySelectorAll('input[value=" $ csrfPlaceholder"]')) {
You can’t perform that action at this time.
0 commit comments