@gechiui/dom
Version:
DOM utilities module for GeChiUI.
25 lines (21 loc) • 656 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = wrap;
var _assertIsDefined = require("../utils/assert-is-defined");
/**
* Internal dependencies
*/
/**
* Wraps the given node with a new node with the given tag name.
*
* @param {Element} newNode The node to insert.
* @param {Element} referenceNode The node to wrap.
*/
function wrap(newNode, referenceNode) {
(0, _assertIsDefined.assertIsDefined)(referenceNode.parentNode, 'referenceNode.parentNode');
referenceNode.parentNode.insertBefore(newNode, referenceNode);
newNode.appendChild(referenceNode);
}
//# sourceMappingURL=wrap.js.map