Sha256: f0884b383796aaaf849bbcc236a84cc7cdd892a9c2f0793092e96990579963f5
Contents?: true
Size: 1.98 KB
Versions: 46
Compression:
Stored size: 1.98 KB
Contents
"use strict"; const { convertNodesIntoNode } = require("../node"); class ChildNodeImpl { remove() { if (!this.parentNode) { return; } this.parentNode._remove(this); } after(...nodes) { const parent = this.parentNode; if (parent) { let viableNextSibling = this.nextSibling; let idx = viableNextSibling ? nodes.indexOf(viableNextSibling) : -1; while (idx !== -1) { viableNextSibling = viableNextSibling.nextSibling; if (!viableNextSibling) { break; } idx = nodes.indexOf(viableNextSibling); } parent._preInsert(convertNodesIntoNode(this._ownerDocument, nodes), viableNextSibling); } } before(...nodes) { const parent = this.parentNode; if (parent) { let viablePreviousSibling = this.previousSibling; let idx = viablePreviousSibling ? nodes.indexOf(viablePreviousSibling) : -1; while (idx !== -1) { viablePreviousSibling = viablePreviousSibling.previousSibling; if (!viablePreviousSibling) { break; } idx = nodes.indexOf(viablePreviousSibling); } parent._preInsert( convertNodesIntoNode(this._ownerDocument, nodes), viablePreviousSibling ? viablePreviousSibling.nextSibling : parent.firstChild ); } } replaceWith(...nodes) { const parent = this.parentNode; if (parent) { let viableNextSibling = this.nextSibling; let idx = viableNextSibling ? nodes.indexOf(viableNextSibling) : -1; while (idx !== -1) { viableNextSibling = viableNextSibling.nextSibling; if (!viableNextSibling) { break; } idx = nodes.indexOf(viableNextSibling); } const node = convertNodesIntoNode(this._ownerDocument, nodes); if (this.parentNode === parent) { parent._replace(node, this); } else { parent._preInsert(node, viableNextSibling); } } } } module.exports = { implementation: ChildNodeImpl };
Version data entries
46 entries across 46 versions & 2 rubygems