/** * Adds an element to the ID and name maps, if necessary. * @param element the element to be added to the ID and name maps */ void addMappedElement(final DomElement element) { addMappedElement(element, false); }
/** * Adds an element to the ID and name maps, if necessary. * @param element the element to be added to the ID and name maps */ void addMappedElement(final HtmlElement element) { addMappedElement(element, false); }
/** * Adds an element to the ID and name maps, if necessary. * @param element the element to be added to the ID and name maps */ void addMappedElement(final DomElement element) { addMappedElement(element, false); }
/** * Adds an element to the ID and name maps, if necessary. * @param element the element to be added to the ID and name maps */ void addMappedElement(final HtmlElement element) { addMappedElement(element, false); }
/** * Adds an element to the ID and name maps, if necessary. * @param element the element to be added to the ID and name maps */ void addMappedElement(final HtmlElement element) { addMappedElement(element, false); }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br> * * @param node the node that has just been added to the document */ void notifyNodeAdded(final DomNode node) { if (node instanceof DomElement) { addMappedElement((DomElement) node, true); if (node instanceof BaseFrameElement) { frameElements_.add((BaseFrameElement) node); } for (final HtmlElement child : node.getHtmlElementDescendants()) { if (child instanceof BaseFrameElement) { frameElements_.add((BaseFrameElement) child); } } if ("base".equals(node.getNodeName())) { calculateBase(); } } node.onAddedToPage(); }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br> * * @param node the node that has just been added to the document */ void notifyNodeAdded(final DomNode node) { if (node instanceof DomElement) { addMappedElement((DomElement) node, true); if (node instanceof BaseFrameElement) { frameElements_.add((BaseFrameElement) node); } for (final HtmlElement child : node.getHtmlElementDescendants()) { if (child instanceof BaseFrameElement) { frameElements_.add((BaseFrameElement) child); } } if ("base".equals(node.getNodeName())) { calculateBase(); } } node.onAddedToPage(); }
private void fireAttributeChangeImpl(final HtmlAttributeChangeEvent event, final HtmlPage htmlPage, final boolean mappedElement, final String oldAttributeValue) { if (mappedElement) { htmlPage.addMappedElement(this); } if (oldAttributeValue == ATTRIBUTE_NOT_DEFINED) { fireHtmlAttributeAdded(event); htmlPage.fireHtmlAttributeAdded(event); } else { fireHtmlAttributeReplaced(event); htmlPage.fireHtmlAttributeReplaced(event); } }
private void fireAttributeChangeImpl(final HtmlAttributeChangeEvent event, final HtmlPage htmlPage, final boolean mappedElement, final String qualifiedName, final String attributeValue, final String oldAttributeValue) { if (mappedElement) { htmlPage.addMappedElement(this); } if (oldAttributeValue == ATTRIBUTE_NOT_DEFINED) { fireHtmlAttributeAdded(event); htmlPage.fireHtmlAttributeAdded(event); } else { fireHtmlAttributeReplaced(event); htmlPage.fireHtmlAttributeReplaced(event); } }
/** * {@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; }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> * * @param node the node that has just been added to the document */ void notifyNodeAdded(final DomNode node) { if (node instanceof HtmlElement) { boolean insideNoScript = false; if (getWebClient().isJavaScriptEnabled()) { for (DomNode parent = node.getParentNode(); parent != null; parent = parent.getParentNode()) { if (parent instanceof HtmlNoScript) { insideNoScript = true; break; } } } if (!insideNoScript) { addMappedElement((HtmlElement) node, true); } if (node.getNodeName().equals("base")) { calculateBase(); } } node.onAddedToPage(); }
/** * Removes an attribute specified by name from this element. * @param attributeName the attribute attributeName */ @Override public final void removeAttribute(final String attributeName) { final String value = getAttribute(attributeName); if (value == ATTRIBUTE_NOT_DEFINED) { return; } final HtmlPage htmlPage = getHtmlPageOrNull(); if (htmlPage != null) { htmlPage.removeMappedElement(this); } super.removeAttribute(attributeName); if (htmlPage != null) { htmlPage.addMappedElement(this); final HtmlAttributeChangeEvent event = new HtmlAttributeChangeEvent(this, attributeName, value); fireHtmlAttributeRemoved(event); htmlPage.fireHtmlAttributeRemoved(event); } }
/** * Removes an attribute specified by name from this element. * @param attributeName the attribute attributeName */ @Override public final void removeAttribute(final String attributeName) { final String value = getAttribute(attributeName); if (value == ATTRIBUTE_NOT_DEFINED) { return; } final HtmlPage htmlPage = getHtmlPageOrNull(); if (htmlPage != null) { htmlPage.removeMappedElement(this); } super.removeAttribute(attributeName); if (htmlPage != null) { htmlPage.addMappedElement(this); final HtmlAttributeChangeEvent event = new HtmlAttributeChangeEvent(this, attributeName, value); fireHtmlAttributeRemoved(event); htmlPage.fireHtmlAttributeRemoved(event); } }
/** * {@inheritDoc} */ @Override public void setTextContent(final String textContent) { final boolean mappedElement = HtmlPage.isMappedElement(getOwnerDocument(), getName()); if (mappedElement) { ((HtmlPage) getPage()).removeMappedElement((HtmlElement) getOwnerElement()); } setValue(textContent); if (mappedElement) { ((HtmlPage) getPage()).addMappedElement(getOwnerElement()); } } }
/** * {@inheritDoc} */ @Override public void setTextContent(final String textContent) { final boolean mappedElement = HtmlPage.isMappedElement(getOwnerDocument(), getName()); if (mappedElement) { ((HtmlPage) getPage()).removeMappedElement((HtmlElement) getOwnerElement()); } setValue(textContent); if (mappedElement) { ((HtmlPage) getPage()).addMappedElement(getOwnerElement()); } } }
/** * Removes an attribute specified by name from this element. * @param attributeName the attribute attributeName */ @Override public final void removeAttribute(final String attributeName) { final String value = getAttribute(attributeName); if (getPage() instanceof HtmlPage) { ((HtmlPage) getPage()).removeMappedElement(this); } super.removeAttribute(attributeName); if (getPage() instanceof HtmlPage) { ((HtmlPage) getPage()).addMappedElement(this); final HtmlAttributeChangeEvent event = new HtmlAttributeChangeEvent(this, attributeName, value); fireHtmlAttributeRemoved(event); ((HtmlPage) getPage()).fireHtmlAttributeRemoved(event); } }
/** * Removes an attribute specified by name from this element. * @param attributeName the attribute attributeName */ @Override public final void removeAttribute(final String attributeName) { final String value = getAttribute(attributeName); if (getPage() instanceof HtmlPage) { ((HtmlPage) getPage()).removeMappedElement(this); } super.removeAttribute(attributeName); if (getPage() instanceof HtmlPage) { ((HtmlPage) getPage()).addMappedElement(this); final HtmlAttributeChangeEvent event = new HtmlAttributeChangeEvent(this, attributeName, value); fireHtmlAttributeRemoved(event); ((HtmlPage) getPage()).fireHtmlAttributeRemoved(event); } }
/** * Removes an attribute specified by name from this element. * @param attributeName the attribute attributeName */ @Override public final void removeAttribute(final String attributeName) { final String value = getAttribute(attributeName); if (getPage() instanceof HtmlPage) { ((HtmlPage) getPage()).removeMappedElement(this); } super.removeAttribute(attributeName); if (getPage() instanceof HtmlPage) { ((HtmlPage) getPage()).addMappedElement(this); final HtmlAttributeChangeEvent event = new HtmlAttributeChangeEvent(this, attributeName, value); fireHtmlAttributeRemoved(event); ((HtmlPage) getPage()).fireHtmlAttributeRemoved(event); } }