@kickscondor/umbrellajs
Version:
Lightweight and intuitive javascript library
10 lines (9 loc) • 313 B
JavaScript
// Replace the matched elements with the passed argument.
u.prototype.replace = function (html, data) {
var nodes = [];
this.adjacent(html, data, function (node, fragment) {
nodes = nodes.concat(this.slice(fragment.children));
node.parentNode.replaceChild(fragment, node);
});
return u(nodes);
};