/** * {@inheritDoc} */ @Override public DomNode cloneNode(final boolean deep) { final DomNode newnode; try { newnode = (DomNode) clone(); } catch (final CloneNotSupportedException e) { throw new IllegalStateException("Clone not supported for node [" + this + "]"); } newnode.parent_ = null; newnode.nextSibling_ = null; newnode.previousSibling_ = null; newnode.scriptObject_ = null; newnode.firstChild_ = null; newnode.attachedToPage_ = false; // if deep, clone the children too. if (deep) { for (DomNode child = firstChild_; child != null; child = child.nextSibling_) { newnode.appendChild(child.cloneNode(true)); } } return newnode; }
/** * {@inheritDoc} */ @Override public DomNode cloneNode(final boolean deep) { final DomNode newnode; try { newnode = (DomNode) clone(); } catch (final CloneNotSupportedException e) { throw new IllegalStateException("Clone not supported for node [" + this + "]"); } newnode.parent_ = null; newnode.nextSibling_ = null; newnode.previousSibling_ = null; newnode.scriptObject_ = null; newnode.firstChild_ = null; newnode.attachedToPage_ = false; // if deep, clone the children too. if (deep) { for (DomNode child = firstChild_; child != null; child = child.nextSibling_) { newnode.appendChild(child.cloneNode(true)); } } return newnode; }
/** * {@inheritDoc} */ public DomNode cloneNode(final boolean deep) { final DomNode newnode; try { newnode = (DomNode) clone(); } catch (final CloneNotSupportedException e) { throw new IllegalStateException("Clone not supported for node [" + this + "]"); } newnode.parent_ = null; newnode.nextSibling_ = null; newnode.previousSibling_ = null; newnode.firstChild_ = null; newnode.scriptObject_ = null; // if deep, clone the kids too. if (deep) { for (DomNode child = firstChild_; child != null; child = child.nextSibling_) { newnode.appendChild(child.cloneNode(true)); } } return newnode; }
/** * {@inheritDoc} */ public DomNode cloneNode(final boolean deep) { final DomNode newnode; try { newnode = (DomNode) clone(); } catch (final CloneNotSupportedException e) { throw new IllegalStateException("Clone not supported for node [" + this + "]"); } newnode.parent_ = null; newnode.nextSibling_ = null; newnode.previousSibling_ = null; newnode.firstChild_ = null; newnode.scriptObject_ = null; // if deep, clone the kids too. if (deep) { for (DomNode child = firstChild_; child != null; child = child.nextSibling_) { newnode.appendChild(child.cloneNode(true)); } } return newnode; }
/** * {@inheritDoc} */ public DomNode cloneNode(final boolean deep) { final DomNode newnode; try { newnode = (DomNode) clone(); } catch (final CloneNotSupportedException e) { throw new IllegalStateException("Clone not supported for node [" + this + "]"); } newnode.parent_ = null; newnode.nextSibling_ = null; newnode.previousSibling_ = null; newnode.firstChild_ = null; newnode.scriptObject_ = null; // if deep, clone the kids too. if (deep) { for (DomNode child = firstChild_; child != null; child = child.nextSibling_) { newnode.appendChild(child.cloneNode(true)); } } return newnode; }
/** * Imports a node from another document to this document. * The source node is not altered or removed from the original document; * this method creates a new copy of the source node. * * @param importedNode the node to import * @param deep Whether to recursively import the subtree under the specified node; or not * @return the imported node that belongs to this Document */ public Object jsxFunction_importNode(final Node importedNode, final boolean deep) { return importedNode.getDomNodeOrDie().cloneNode(deep).getScriptObject(); }
/** * Imports a node from another document to this document. * The source node is not altered or removed from the original document; * this method creates a new copy of the source node. * * @param importedNode the node to import * @param deep Whether to recursively import the subtree under the specified node; or not * @return the imported node that belongs to this Document */ public Object jsxFunction_importNode(final Node importedNode, final boolean deep) { return importedNode.getDomNodeOrDie().cloneNode(deep).getScriptObject(); }
/** * Imports a node from another document to this document. * The source node is not altered or removed from the original document; * this method creates a new copy of the source node. * * @param importedNode the node to import * @param deep Whether to recursively import the subtree under the specified node; or not * @return the imported node that belongs to this Document */ public Object jsxFunction_importNode(final Node importedNode, final boolean deep) { return importedNode.getDomNodeOrDie().cloneNode(deep).getScriptObject(); }
/** * Clones this node. * @param deep if {@code true}, recursively clones all descendants * @return the newly cloned node */ @JsxFunction public Object cloneNode(final boolean deep) { final DomNode domNode = getDomNodeOrDie(); final DomNode clonedNode = domNode.cloneNode(deep); final Node jsClonedNode = getJavaScriptNode(clonedNode); return jsClonedNode; }
/** * Clones this node. * @param deep if {@code true}, recursively clones all descendants * @return the newly cloned node */ @JsxFunction public Object cloneNode(final boolean deep) { final DomNode domNode = getDomNodeOrDie(); final DomNode clonedNode = domNode.cloneNode(deep); final Node jsClonedNode = getJavaScriptNode(clonedNode); return jsClonedNode; }
/** * Clones a new node. * @param deep flag that indicates whether to recursively clone all nodes that are descendants of this node; * if {@code true}, creates a clone of the complete tree below this node, * if {@code false}, clones this node and its attributes only * @return the newly created clone node */ @JsxFunction public Object cloneNode(final boolean deep) { final DomNode domNode = getDomNodeOrDie(); final DomNode clonedNode = domNode.cloneNode(deep); final XMLDOMNode jsClonedNode = getJavaScriptNode(clonedNode); return jsClonedNode; }
/** * Clones a new node. * @param deep flag that indicates whether to recursively clone all nodes that are descendants of this node; * if {@code true}, creates a clone of the complete tree below this node, * if {@code false}, clones this node and its attributes only * @return the newly created clone node */ @JsxFunction public Object cloneNode(final boolean deep) { final DomNode domNode = getDomNodeOrDie(); final DomNode clonedNode = domNode.cloneNode(deep); final XMLDOMNode jsClonedNode = getJavaScriptNode(clonedNode); return jsClonedNode; }
/** * {@inheritDoc} */ @Override public HtmlPage cloneNode(final boolean deep) { // we need the ScriptObject clone before cloning the kids. final HtmlPage result = (HtmlPage) super.cloneNode(false); final SimpleScriptable jsObjClone = ((SimpleScriptable) getScriptableObject()).clone(); jsObjClone.setDomNode(result); // if deep, clone the kids too, and re initialize parts of the clone if (deep) { synchronized (lock_) { result.attributeListeners_ = null; } result.selectionRanges_ = new ArrayList<>(3); result.afterLoadActions_ = new ArrayList<>(); result.frameElements_ = new TreeSet<>(documentPositionComparator); for (DomNode child = getFirstChild(); child != null; child = child.getNextSibling()) { result.appendChild(child.cloneNode(true)); } } return result; }
/** * {@inheritDoc} */ @Override public HtmlPage cloneNode(final boolean deep) { // we need the ScriptObject clone before cloning the kids. final HtmlPage result = (HtmlPage) super.cloneNode(false); final SimpleScriptable jsObjClone = ((SimpleScriptable) getScriptableObject()).clone(); jsObjClone.setDomNode(result); // if deep, clone the kids too, and re initialize parts of the clone if (deep) { synchronized (lock_) { result.attributeListeners_ = null; } result.selectionRanges_ = new ArrayList<>(3); result.afterLoadActions_ = new ArrayList<>(); result.frameElements_ = new TreeSet<>(documentPositionComparator); for (DomNode child = getFirstChild(); child != null; child = child.getNextSibling()) { result.appendChild(child.cloneNode(true)); } } return result; }
/** * Clones this node. * @param deep if <tt>true</tt>, recursively clones all descendants * @return the newly cloned node */ public Object jsxFunction_cloneNode(final boolean deep) { final DomNode domNode = getDomNodeOrDie(); final DomNode clonedNode = domNode.cloneNode(deep); final Node jsClonedNode = getJavaScriptNode(clonedNode); if (getBrowserVersion().isIE()) { // need to copy the event listener when they exist copyEventListenersWhenNeeded(domNode, clonedNode); } return jsClonedNode; }
/** * Clones this node. * @param deep if <tt>true</tt>, recursively clones all descendants * @return the newly cloned node */ public Object jsxFunction_cloneNode(final boolean deep) { final DomNode domNode = getDomNodeOrDie(); final DomNode clonedNode = domNode.cloneNode(deep); final Node jsClonedNode = getJavaScriptNode(clonedNode); if (getBrowserVersion().isIE()) { // need to copy the event listener when they exist copyEventListenersWhenNeeded(domNode, clonedNode); } return jsClonedNode; }
/** * Clones this node. * @param deep if <tt>true</tt>, recursively clones all descendants * @return the newly cloned node */ public Object jsxFunction_cloneNode(final boolean deep) { final DomNode domNode = getDomNodeOrDie(); final DomNode clonedNode = domNode.cloneNode(deep); final Node jsClonedNode = getJavaScriptNode(clonedNode); if (getBrowserVersion().isIE()) { // need to copy the event listener when they exist copyEventListenersWhenNeeded(domNode, clonedNode); } return jsClonedNode; }
/** * Clones this node. * @param deep if <tt>true</tt>, recursively clones all descendants * @return the newly cloned node */ public Object jsxFunction_cloneNode(final boolean deep) { final DomNode domNode = getDomNodeOrDie(); final DomNode clonedNode = domNode.cloneNode(deep); final Node jsClonedNode = getJavaScriptNode(clonedNode); if (getBrowserVersion().hasFeature(BrowserVersionFeatures.JS_CLONE_NODE_COPIES_EVENT_LISTENERS)) { // need to copy the event listener when they exist copyEventListenersWhenNeeded(domNode, clonedNode); } return jsClonedNode; }
/** * Imports a node from another document to this document. * The source node is not altered or removed from the original document; * this method creates a new copy of the source node. * * @param importedNode the node to import * @param deep Whether to recursively import the subtree under the specified node; or not * @return the imported node that belongs to this Document */ @JsxFunction public Object importNode(final Node importedNode, final boolean deep) { DomNode domNode = importedNode.getDomNodeOrDie(); domNode = domNode.cloneNode(deep); domNode.processImportNode(this); for (final DomNode childNode : domNode.getDescendants()) { childNode.processImportNode(this); } return domNode.getScriptableObject(); }
/** * Imports a node from another document to this document. * The source node is not altered or removed from the original document; * this method creates a new copy of the source node. * * @param importedNode the node to import * @param deep Whether to recursively import the subtree under the specified node; or not * @return the imported node that belongs to this Document */ @JsxFunction public Object importNode(final Node importedNode, final boolean deep) { DomNode domNode = importedNode.getDomNodeOrDie(); domNode = domNode.cloneNode(deep); domNode.processImportNode(this); for (final DomNode childNode : domNode.getDescendants()) { childNode.processImportNode(this); } return domNode.getScriptableObject(); }