public Node removeChild(Node oldChild) throws DOMException { LeafNodeImpl oldChildImpl = (LeafNodeImpl) oldChild; if (oldChildImpl.document != document) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null); } if (oldChildImpl.parent != this) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null); } int index = oldChildImpl.index; children.remove(index); oldChildImpl.parent = null; refreshIndices(index); return oldChild; }
/** * Inserts {@code newChild} at {@code index}. If it is already child of * another node, it is removed from there. */ Node insertChildAt(Node newChild, int index) throws DOMException { if (newChild instanceof DocumentFragment) { NodeList toAdd = newChild.getChildNodes(); for (int i = 0; i < toAdd.getLength(); i++) { insertChildAt(toAdd.item(i), index + i); } return newChild; } LeafNodeImpl toInsert = (LeafNodeImpl) newChild; if (toInsert.document != null && document != null && toInsert.document != document) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null); } if (toInsert.isParentOf(this)) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null); } if (toInsert.parent != null) { int oldIndex = toInsert.index; toInsert.parent.children.remove(oldIndex); toInsert.parent.refreshIndices(oldIndex); } children.add(index, toInsert); toInsert.parent = this; refreshIndices(index); return newChild; }
public Node removeChild(Node oldChild) throws DOMException { LeafNodeImpl oldChildImpl = (LeafNodeImpl) oldChild; if (oldChildImpl.document != document) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null); } if (oldChildImpl.parent != this) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null); } int index = oldChildImpl.index; children.remove(index); oldChildImpl.parent = null; refreshIndices(index); return oldChild; }
public Node removeChild(Node oldChild) throws DOMException { LeafNodeImpl oldChildImpl = (LeafNodeImpl) oldChild; if (oldChildImpl.document != document) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null); } if (oldChildImpl.parent != this) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null); } int index = oldChildImpl.index; children.remove(index); oldChildImpl.parent = null; refreshIndices(index); return oldChild; }
public Node removeChild(Node oldChild) throws DOMException { LeafNodeImpl oldChildImpl = (LeafNodeImpl) oldChild; if (oldChildImpl.document != document) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null); } if (oldChildImpl.parent != this) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null); } int index = oldChildImpl.index; children.remove(index); oldChildImpl.parent = null; refreshIndices(index); return oldChild; }
public Node removeChild(Node oldChild) throws DOMException { LeafNodeImpl oldChildImpl = (LeafNodeImpl) oldChild; if (oldChildImpl.document != document) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null); } if (oldChildImpl.parent != this) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null); } int index = oldChildImpl.index; children.remove(index); oldChildImpl.parent = null; refreshIndices(index); return oldChild; }
public Node removeChild(Node oldChild) throws DOMException { LeafNodeImpl oldChildImpl = (LeafNodeImpl) oldChild; if (oldChildImpl.document != document) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null); } if (oldChildImpl.parent != this) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null); } int index = oldChildImpl.index; children.remove(index); oldChildImpl.parent = null; refreshIndices(index); return oldChild; }
public Node removeChild(Node oldChild) throws DOMException { LeafNodeImpl oldChildImpl = (LeafNodeImpl) oldChild; if (oldChildImpl.document != document) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null); } if (oldChildImpl.parent != this) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null); } int index = oldChildImpl.index; children.remove(index); oldChildImpl.parent = null; refreshIndices(index); return oldChild; }
/** * Inserts {@code newChild} at {@code index}. If it is already child of * another node, it is removed from there. */ Node insertChildAt(Node newChild, int index) throws DOMException { if (newChild instanceof DocumentFragment) { NodeList toAdd = newChild.getChildNodes(); for (int i = 0; i < toAdd.getLength(); i++) { insertChildAt(toAdd.item(i), index + i); } return newChild; } LeafNodeImpl toInsert = (LeafNodeImpl) newChild; if (toInsert.document != null && document != null && toInsert.document != document) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null); } if (toInsert.isParentOf(this)) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null); } if (toInsert.parent != null) { int oldIndex = toInsert.index; toInsert.parent.children.remove(oldIndex); toInsert.parent.refreshIndices(oldIndex); } children.add(index, toInsert); toInsert.parent = this; refreshIndices(index); return newChild; }
/** * Inserts {@code newChild} at {@code index}. If it is already child of * another node, it is removed from there. */ Node insertChildAt(Node newChild, int index) throws DOMException { if (newChild instanceof DocumentFragment) { NodeList toAdd = newChild.getChildNodes(); for (int i = 0; i < toAdd.getLength(); i++) { insertChildAt(toAdd.item(i), index + i); } return newChild; } LeafNodeImpl toInsert = (LeafNodeImpl) newChild; if (toInsert.document != null && document != null && toInsert.document != document) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null); } if (toInsert.isParentOf(this)) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null); } if (toInsert.parent != null) { int oldIndex = toInsert.index; toInsert.parent.children.remove(oldIndex); toInsert.parent.refreshIndices(oldIndex); } children.add(index, toInsert); toInsert.parent = this; refreshIndices(index); return newChild; }
/** * Inserts {@code newChild} at {@code index}. If it is already child of * another node, it is removed from there. */ Node insertChildAt(Node newChild, int index) throws DOMException { if (newChild instanceof DocumentFragment) { NodeList toAdd = newChild.getChildNodes(); for (int i = 0; i < toAdd.getLength(); i++) { insertChildAt(toAdd.item(i), index + i); } return newChild; } LeafNodeImpl toInsert = (LeafNodeImpl) newChild; if (toInsert.document != null && document != null && toInsert.document != document) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null); } if (toInsert.isParentOf(this)) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null); } if (toInsert.parent != null) { int oldIndex = toInsert.index; toInsert.parent.children.remove(oldIndex); toInsert.parent.refreshIndices(oldIndex); } children.add(index, toInsert); toInsert.parent = this; refreshIndices(index); return newChild; }
/** * Inserts {@code newChild} at {@code index}. If it is already child of * another node, it is removed from there. */ Node insertChildAt(Node newChild, int index) throws DOMException { if (newChild instanceof DocumentFragment) { NodeList toAdd = newChild.getChildNodes(); for (int i = 0; i < toAdd.getLength(); i++) { insertChildAt(toAdd.item(i), index + i); } return newChild; } LeafNodeImpl toInsert = (LeafNodeImpl) newChild; if (toInsert.document != null && document != null && toInsert.document != document) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null); } if (toInsert.isParentOf(this)) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null); } if (toInsert.parent != null) { int oldIndex = toInsert.index; toInsert.parent.children.remove(oldIndex); toInsert.parent.refreshIndices(oldIndex); } children.add(index, toInsert); toInsert.parent = this; refreshIndices(index); return newChild; }
/** * Inserts {@code newChild} at {@code index}. If it is already child of * another node, it is removed from there. */ Node insertChildAt(Node newChild, int index) throws DOMException { if (newChild instanceof DocumentFragment) { NodeList toAdd = newChild.getChildNodes(); for (int i = 0; i < toAdd.getLength(); i++) { insertChildAt(toAdd.item(i), index + i); } return newChild; } LeafNodeImpl toInsert = (LeafNodeImpl) newChild; if (toInsert.document != null && document != null && toInsert.document != document) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null); } if (toInsert.isParentOf(this)) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null); } if (toInsert.parent != null) { int oldIndex = toInsert.index; toInsert.parent.children.remove(oldIndex); toInsert.parent.refreshIndices(oldIndex); } children.add(index, toInsert); toInsert.parent = this; refreshIndices(index); return newChild; }
/** * Inserts {@code newChild} at {@code index}. If it is already child of * another node, it is removed from there. */ Node insertChildAt(Node newChild, int index) throws DOMException { if (newChild instanceof DocumentFragment) { NodeList toAdd = newChild.getChildNodes(); for (int i = 0; i < toAdd.getLength(); i++) { insertChildAt(toAdd.item(i), index + i); } return newChild; } LeafNodeImpl toInsert = (LeafNodeImpl) newChild; if (toInsert.document != null && document != null && toInsert.document != document) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null); } if (toInsert.isParentOf(this)) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null); } if (toInsert.parent != null) { int oldIndex = toInsert.index; toInsert.parent.children.remove(oldIndex); toInsert.parent.refreshIndices(oldIndex); } children.add(index, toInsert); toInsert.parent = this; refreshIndices(index); return newChild; }