Переглянути джерело

fix: polyfill `Element.replaceChildren` (#7034)

David Luzar 1 рік тому
батько
коміт
556175558a
1 змінених файлів з 7 додано та 0 видалено
  1. 7 0
      src/polyfill.ts

+ 7 - 0
src/polyfill.ts

@@ -22,5 +22,12 @@ const polyfill = () => {
       configurable: true,
     });
   }
+
+  if (!Element.prototype.replaceChildren) {
+    Element.prototype.replaceChildren = function (...nodes) {
+      this.innerHTML = "";
+      this.append(...nodes);
+    };
+  }
 };
 export default polyfill;