polyfill-service
Version:
A polyfill combinator
12 lines (10 loc) • 441 B
JavaScript
Document.prototype.after = Element.prototype.after = function after() {
if (this.parentNode) {
this.parentNode.insertBefore(_mutation(arguments), this.nextSibling);
}
};
// 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.after = Element.prototype.after;
}