ChildNode ponyfill.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 63b82fa Sep 30, 2017

README.md

ChildNode ponyfill

ChildNode ponyfill.

Install

npm i @yuheiy/childnode-ponyfill

Usage

import {replaceWith} from '@yuheiy/childnode-ponyfill'
const oldElement = document.querySelector('#old')
const newElement = document.createElement('div')
replaceWith(oldElement, newElement)

API

before(childNode, ...nodes)

export declare const before: (childNode: Element | CharacterData | DocumentType, ...nodes: (string | Node)[]) => void;

Same API with ChildNode.before().

after(childNode, ...nodes)

export declare const after: (childNode: Element | CharacterData | DocumentType, ...nodes: (string | Node)[]) => void;

Same API with ChildNode.after().

replaceWith(childNode, ...nodes)

export declare const replaceWith: (childNode: Element | CharacterData | DocumentType, ...nodes: (string | Node)[]) => void;

Same API with ChildNode.replaceWith().

remove(childNode)

export declare const remove: (childNode: Element | CharacterData | DocumentType) => void;

Same API with ChildNode.remove().

License

MIT