0.1.0 • Published 5 years ago

parent-node-replace-all v0.1.0

Weekly downloads
2
License
CC0-1.0
Repository
github
Last release
5 years ago

parent-node-replace-all

NPM Version Build Status Support Chat

parent-node-replace-all is a ponyfill for the speculative ParentNode.replaceAll method.

<script src="https://unpkg.com/parent-node-replace-all/ponyfill"></script>
npm install parent-node-replace-all

The ParentNode.replaceAll method removes all child nodes from a ParentNode while allowing the insertion of a new set of nodes.

// node usage
import replaceAll from 'parent-node-replace-all';

// replace all of the elements in a document (script or node usage)
document::replaceAll(replacementDocumentFragment);

The script is approximately 120 bytes when minified and gzipped.

Usage

For immediate usage, add this script to your document:

<script src="https://unpkg.com/parent-node-replace-all/ponyfill"></script>

For Node usage, import parent-node-replace-all:

const parentNodeReplaceAll = require('parent-node-replace-all');

// ...

Browser compatibility

BrowserNative SupportPolyfill Support
Android2.2+
Blackberry7+
Chrome4+
Edge12+
Firefox3.5+
Internet Explorer8+
Opera10+
Opera Mobile12+
Safari (iOS)3.2+
Safari (MacOS)3.1+