UNPKG

@wordpress/dom

Version:
27 lines (25 loc) 624 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = unwrap; var _assertIsDefined = require("../utils/assert-is-defined"); /** * Internal dependencies */ /** * Unwrap the given node. This means any child nodes are moved to the parent. * * @param {Node} node The node to unwrap. * * @return {void} */ function unwrap(node) { const parent = node.parentNode; (0, _assertIsDefined.assertIsDefined)(parent, 'node.parentNode'); while (node.firstChild) { parent.insertBefore(node.firstChild, node); } parent.removeChild(node); } //# sourceMappingURL=unwrap.js.map