dom-tools
Version:
A tiny collection of DOM helpers for IE8+.
19 lines (16 loc) • 434 B
JavaScript
var insertAfter = require('./insertAfter');
// IE8+
//
// Attempts to mirror $.after for htmlString and Elements.
//
// Portion of this method is a snippet from:
// http://youmightnotneedjquery.com/#after
//
function after(/* Element */ el, elementOrText) {
if (typeof elementOrText === 'string') {
el.insertAdjacentHTML('afterend', elementOrText);
} else {
insertAfter(elementOrText, el);
}
}
module.exports = after;