/** * Removes all of this node's children. */ public void removeAllChildren() { if (getFirstChild() == null) { return; } for (final Iterator<DomNode> it = getChildren().iterator(); it.hasNext();) { it.next().removeAllChildren(); it.remove(); } }
/** * Removes all of this node's children. */ public void removeAllChildren() { if (getFirstChild() == null) { return; } for (final Iterator<DomNode> it = getChildren().iterator(); it.hasNext();) { it.next().removeAllChildren(); it.remove(); } }
/** * Removes all of this node's children. */ public void removeAllChildren() { if (getFirstChild() == null) { return; } for (final Iterator<DomNode> it = getChildren().iterator(); it.hasNext();) { it.next().removeAllChildren(); it.remove(); } }
/** * {@inheritDoc} */ @Override public void setTextContent(final String textContent) { removeAllChildren(); if (textContent != null && !textContent.isEmpty()) { appendChild(new DomText(getPage(), textContent)); } }
/** * {@inheritDoc} */ @Override public void setTextContent(final String textContent) { removeAllChildren(); if (textContent != null && !textContent.isEmpty()) { appendChild(new DomText(getPage(), textContent)); } }
/** * The worker for setInnerText. * @param value the new value for the contents of this node */ protected void setInnerTextImpl(final String value) { final DomNode domNode = getDomNodeOrDie(); domNode.removeAllChildren(); if (value != null && !value.isEmpty()) { domNode.appendChild(new DomText(domNode.getPage(), value)); } }
/** * The worker for setInnerText. * @param value the new value for the contents of this node */ protected void setInnerTextImpl(final String value) { final DomNode domNode = getDomNodeOrDie(); domNode.removeAllChildren(); if (value != null && !value.isEmpty()) { domNode.appendChild(new DomText(domNode.getPage(), value)); } }
/** * {@inheritDoc} */ public void setTextContent(final String textContent) { removeAllChildren(); appendChild(new DomText(getPage(), textContent)); }
/** * {@inheritDoc} */ public void setTextContent(final String textContent) { removeAllChildren(); appendChild(new DomText(getPage(), textContent)); }
/** * {@inheritDoc} */ public void setTextContent(final String textContent) { removeAllChildren(); appendChild(new DomText(getPage(), textContent)); }
/** * Replaces all child elements of this element with the supplied value. * @param value the new value for the contents of this element */ @JsxSetter({CHROME, FF}) public void setInnerHTML(final Object value) { final DomNode domNode; try { domNode = getDomNodeOrDie(); } catch (final IllegalStateException e) { Context.throwAsScriptRuntimeEx(e); return; } domNode.removeAllChildren(); final boolean addChildForNull = getBrowserVersion().hasFeature(JS_INNER_HTML_ADD_CHILD_FOR_NULL_VALUE); if ((value == null && addChildForNull) || (value != null && !"".equals(value))) { final String valueAsString = Context.toString(value); parseHtmlSnippet(domNode, valueAsString); } }
/** * Replaces all child elements of this element with the supplied value. * @param value the new value for the contents of this element */ @JsxSetter({CHROME, FF}) public void setInnerHTML(final Object value) { final DomNode domNode; try { domNode = getDomNodeOrDie(); } catch (final IllegalStateException e) { Context.throwAsScriptRuntimeEx(e); return; } domNode.removeAllChildren(); getWindow().clearComputedStylesUpToRoot(this); final boolean addChildForNull = getBrowserVersion().hasFeature(JS_INNER_HTML_ADD_CHILD_FOR_NULL_VALUE); if ((value == null && addChildForNull) || (value != null && !"".equals(value))) { final String valueAsString = Context.toString(value); parseHtmlSnippet(domNode, valueAsString); } }
/** * Replace all children elements of this element with the supplied value. * @param value - the new value for the contents of this node */ public void jsxSet_innerHTML(final Object value) { final DomNode domNode = getDomNodeOrDie(); final boolean ie = getBrowserVersion().isIE(); if (ie && INNER_HTML_READONLY_IN_IE.contains(domNode.getNodeName())) { throw Context.reportRuntimeError("innerHTML is read-only for tag " + domNode.getNodeName()); } domNode.removeAllChildren(); // null && IE -> add child // null && non-IE -> Don't add // '' -> Don't add if ((value == null && ie) || (value != null && !"".equals(value))) { final String valueAsString = Context.toString(value); parseHtmlSnippet(domNode, true, valueAsString); //if the parentNode has null parentNode in IE, //create a DocumentFragment to be the parentNode's parentNode. if (domNode.getParentNode() == null && ie) { final DomDocumentFragment fragment = ((HtmlPage) domNode.getPage()).createDomDocumentFragment(); fragment.appendChild(domNode); } } }
/** * Replace all children elements of this element with the supplied value. * @param value - the new value for the contents of this node */ public void jsxSet_innerHTML(final Object value) { final DomNode domNode = getDomNodeOrDie(); final boolean ie = getBrowserVersion().isIE(); if (ie && INNER_HTML_READONLY_IN_IE.contains(domNode.getNodeName())) { throw Context.reportRuntimeError("innerHTML is read-only for tag " + domNode.getNodeName()); } domNode.removeAllChildren(); // null && IE -> add child // null && non-IE -> Don't add // '' -> Don't add if ((value == null && ie) || (value != null && !"".equals(value))) { final String valueAsString = Context.toString(value); parseHtmlSnippet(domNode, true, valueAsString); //if the parentNode has null parentNode in IE, //create a DocumentFragment to be the parentNode's parentNode. if (domNode.getParentNode() == null && ie) { final DomDocumentFragment fragment = ((HtmlPage) domNode.getPage()).createDomDocumentFragment(); fragment.appendChild(domNode); } } }
/** * Replace all children elements of this element with the supplied value. * @param value - the new value for the contents of this node */ public void jsxSet_innerHTML(final Object value) { final DomNode domNode = getDomNodeOrDie(); final boolean ie = getBrowserVersion().isIE(); if (ie && INNER_HTML_READONLY_IN_IE.contains(domNode.getNodeName())) { throw Context.reportRuntimeError("innerHTML is read-only for tag " + domNode.getNodeName()); } domNode.removeAllChildren(); // null && IE -> add child // null && non-IE -> Don't add // '' -> Don't add if ((value == null && ie) || (value != null && !"".equals(value))) { final String valueAsString = Context.toString(value); parseHtmlSnippet(domNode, true, valueAsString); //if the parentNode has null parentNode in IE, //create a DocumentFragment to be the parentNode's parentNode. if (domNode.getParentNode() == null && ie) { final DomDocumentFragment fragment = ((HtmlPage) domNode.getPage()).createDomDocumentFragment(); fragment.appendChild(domNode); } } }
/** * Replace all children elements of this element with the supplied value. * @param value - the new value for the contents of this node */ public void jsxSet_innerText(final String value) { final DomNode domNode = getDomNodeOrDie(); if (INNER_TEXT_READONLY.contains(domNode.getNodeName())) { throw Context.reportRuntimeError("innerText is read-only for tag " + domNode.getNodeName()); } domNode.removeAllChildren(); final DomNode node = new DomText(getDomNodeOrDie().getPage(), value); domNode.appendChild(node); //if the parentNode has null parentNode in IE, //create a DocumentFragment to be the parentNode's parentNode. if (domNode.getParentNode() == null && getBrowserVersion().isIE()) { final DomDocumentFragment fragment = ((HtmlPage) domNode.getPage()).createDomDocumentFragment(); fragment.appendChild(domNode); } }
/** * Replace all children elements of this element with the supplied value. * @param value - the new value for the contents of this node */ public void jsxSet_innerText(final String value) { final DomNode domNode = getDomNodeOrDie(); if (INNER_TEXT_READONLY.contains(domNode.getNodeName())) { throw Context.reportRuntimeError("innerText is read-only for tag " + domNode.getNodeName()); } domNode.removeAllChildren(); final DomNode node = new DomText(getDomNodeOrDie().getPage(), value); domNode.appendChild(node); //if the parentNode has null parentNode in IE, //create a DocumentFragment to be the parentNode's parentNode. if (domNode.getParentNode() == null && getBrowserVersion().isIE()) { final DomDocumentFragment fragment = ((HtmlPage) domNode.getPage()).createDomDocumentFragment(); fragment.appendChild(domNode); } }
/** * Replace all children elements of this element with the supplied value. * @param value - the new value for the contents of this node */ public void jsxSet_innerText(final String value) { final DomNode domNode = getDomNodeOrDie(); if (INNER_TEXT_READONLY.contains(domNode.getNodeName())) { throw Context.reportRuntimeError("innerText is read-only for tag " + domNode.getNodeName()); } domNode.removeAllChildren(); final DomNode node = new DomText(getDomNodeOrDie().getPage(), value); domNode.appendChild(node); //if the parentNode has null parentNode in IE, //create a DocumentFragment to be the parentNode's parentNode. if (domNode.getParentNode() == null && getBrowserVersion().isIE()) { final DomDocumentFragment fragment = ((HtmlPage) domNode.getPage()).createDomDocumentFragment(); fragment.appendChild(domNode); } }
if (null == parent) { if (getBrowserVersion().hasFeature(JS_OUTER_HTML_REMOVES_CHILDREN_FOR_DETACHED)) { domNode.removeAllChildren();
if (null == parent) { if (getBrowserVersion().hasFeature(JS_OUTER_HTML_REMOVES_CHILDREN_FOR_DETACHED)) { domNode.removeAllChildren();