0.1.0 • Published 5 years ago
parent-node-replace-all v0.1.0
parent-node-replace-all
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
Browser | Native Support | Polyfill Support |
---|---|---|
Android | ✘ | 2.2+ |
Blackberry | ✘ | 7+ |
Chrome | ✘ | 4+ |
Edge | ✘ | 12+ |
Firefox | ✘ | 3.5+ |
Internet Explorer | ✘ | 8+ |
Opera | ✘ | 10+ |
Opera Mobile | ✘ | 12+ |
Safari (iOS) | ✘ | 3.2+ |
Safari (MacOS) | ✘ | 3.1+ |
0.1.0
5 years ago