Prechádzať zdrojové kódy

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

David Luzar 1 rok pred
rodič
commit
556175558a
1 zmenil súbory, kde vykonal 7 pridanie a 0 odobranie
  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;