/** * {@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; }
/** * {@inheritDoc} * Override cloneNode to add cloned elements to the clone, not to the original. */ @Override public HtmlPage cloneNode(final boolean deep) { final HtmlPage result = (HtmlPage) super.cloneNode(deep); result.setScriptObject(getScriptObject()); if (deep) { // fix up idMap_ and result's idMap_s for (final HtmlElement child : result.getAllHtmlChildElements()) { removeMappedElement(child); result.addMappedElement(child); } } return result; }
/** * {@inheritDoc} * Override cloneNode to add cloned elements to the clone, not to the original. */ @Override public HtmlPage cloneNode(final boolean deep) { final HtmlPage result = (HtmlPage) super.cloneNode(deep); result.setScriptObject(getScriptObject()); if (deep) { // fix up idMap_ and result's idMap_s for (final HtmlElement child : result.getAllHtmlChildElements()) { removeMappedElement(child); result.addMappedElement(child); } } return result; }
/** * {@inheritDoc} * Override cloneNode to add cloned elements to the clone, not to the original. */ @Override public HtmlPage cloneNode(final boolean deep) { final HtmlPage result = (HtmlPage) super.cloneNode(deep); result.setScriptObject(getScriptObject()); if (deep) { // fix up idMap_ and result's idMap_s for (final HtmlElement child : result.getAllHtmlChildElements()) { removeMappedElement(child); result.addMappedElement(child); } } return result; }