public static void replaceChild(Parent parent, Node newChild, Node oldNode) { int idx = parent.nodeIndexOf(oldNode); if (idx < 0) { parent.addNode(newChild); } else { parent.removeNode(idx); parent.addNode(idx, newChild); } }
public static void replaceChild(Parent parent, Node newChild, Node oldNode) { int idx = parent.nodeIndexOf(oldNode); if (idx < 0) { parent.addNode(newChild); } else { parent.removeNode(idx); parent.addNode(idx, newChild); } }
private void replace(Element what, Element with) { Parent parent = what.getParent(); int idx = parent.nodeIndexOf(what); what.remove(); parent.addNode(idx, with); }
Parent grandParent = root.getParent(); if (grandParent != null) { grandParent.addNode(grandParent.nodeIndexOf(root), c); } else { LOG.warn("Cannot save the comment '{}' as there's no parent in the DOM", text);
Parent grandParent = root.getParent(); if (grandParent != null) { grandParent.addNode(grandParent.nodeIndexOf(root), c); } else { LOG.warn("Cannot save the comment '{}' as there's no parent in the DOM", text);