UNPKG

polyfill-service

Version:
12 lines (10 loc) 459 B
Document.prototype.replaceWith = Element.prototype.replaceWith = function replaceWith() { if (this.parentNode) { this.parentNode.replaceChild(_mutation(arguments), this); } }; // Not all UAs support the Text constructor. Polyfill on the Text constructor only where it exists // TODO: Add a polyfill for the Text constructor, and make it a dependency of this polyfill. if ('Text' in this) { Text.prototype.replaceWith = Element.prototype.replaceWith; }