Add `wrap`
Closed this issue · 0 comments
Tokimon commented
to wrap an element in given HTML:
function findEmptyElm (elm) {
const child = elm && elm.firstElementChild
return child ? findEmptyElm(next) : elm
}
export default (elm, html) => {
elm.insertAdjacentHTML('afterend', html)
const insertElm = findEmptyElm(elm.nextElementSibling)
insertElm && insertElm.appendChild(elm)
}