@yuheiy/childnode-ponyfill
v0.0.4
Published
ChildNode ponyfill.
Downloads
1
Readme
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