/** * {@inheritDoc} */ @Override public String asXml() { final StringBuilder sb = new StringBuilder(); for (final DomNode node : getChildren()) { sb.append(node.asXml()); } return sb.toString(); }
/** * Creates an empty {@link DomDocumentFragment} object. * @return a newly created {@link DomDocumentFragment} */ @Override public DomDocumentFragment createDocumentFragment() { return new DomDocumentFragment(this); }
/** * {@inheritDoc} */ @Override public String asXml() { return getFirstChild().asXml(); } }
/** * Parses an HTML snippet. * @param valueAsString text that contains text and tags to be converted to a document fragment * @return a document fragment * @see <a href="http://developer.mozilla.org/en/docs/DOM:range.createContextualFragment">Mozilla documentation</a> */ public Object jsxFunction_createContextualFragment(final String valueAsString) { final SgmlPage page = startContainer_.getDomNodeOrDie().getPage(); final DomDocumentFragment fragment = new DomDocumentFragment(page); HTMLElement.parseHtmlSnippet(fragment, true, valueAsString); return fragment.getScriptObject(); } }
for (final DomNode child : fragment.getChildren()) { insertBeforeImpl(new Object[] {child.getScriptableObject(), refChildObject}); fragment.appendChild(domNode);
/** * Parsing of the children is done, we can move our children to the content. */ @Override protected void onAllChildrenAddedToPage(final boolean postponed) { while (getFirstChild() != null) { final DomNode child = getFirstChild(); child.basicRemove(); domDocumentFragment_.appendChild(child); } } }
return new DomDocumentFragment(null); final DomDocumentFragment fragment = new DomDocumentFragment(page); if (start == end) { fragment.appendChild(ancestorClone); fragment.appendChild(n);
/** * Parses an HTML snippet. * @param valueAsString text that contains text and tags to be converted to a document fragment * @return a document fragment * @see <a href="https://developer.mozilla.org/en-US/docs/DOM/range.createContextualFragment">Mozilla * documentation</a> */ @JsxFunction public Object createContextualFragment(final String valueAsString) { final SgmlPage page = startContainer_.getDomNodeOrDie().getPage(); final DomDocumentFragment fragment = new DomDocumentFragment(page); try { HTMLParser.parseFragment(fragment, startContainer_.getDomNodeOrDie(), valueAsString); } catch (final Exception e) { LogFactory.getLog(Range.class).error("Unexpected exception occurred in createContextualFragment", e); throw Context.reportRuntimeError("Unexpected exception occurred in createContextualFragment: " + e.getMessage()); } return fragment.getScriptableObject(); }
node.setPrototype(getPrototype(node.getClass())); node.setDomNode(fragment); output_ = fragment.getScriptObject();
for (final DomNode child : fragment.getChildren()) { insertBeforeImpl(new Object[] {child.getScriptableObject(), refChildObject}); fragment.appendChild(domNode);
/** * Parsing of the children is done, we can move our children to the content. */ @Override protected void onAllChildrenAddedToPage(final boolean postponed) { while (getFirstChild() != null) { final DomNode child = getFirstChild(); child.basicRemove(); domDocumentFragment_.appendChild(child); } } }
return new DomDocumentFragment(null); final DomDocumentFragment fragment = new DomDocumentFragment(page); if (start == end) { fragment.appendChild(ancestorClone); fragment.appendChild(n);
/** * Parses an HTML snippet. * @param valueAsString text that contains text and tags to be converted to a document fragment * @return a document fragment * @see <a href="http://developer.mozilla.org/en/docs/DOM:range.createContextualFragment">Mozilla documentation</a> */ public Object jsxFunction_createContextualFragment(final String valueAsString) { final SgmlPage page = startContainer_.getDomNodeOrDie().getPage(); final DomDocumentFragment fragment = new DomDocumentFragment(page); HTMLElement.parseHtmlSnippet(fragment, true, valueAsString); return fragment.getScriptObject(); } }
/** * Parses an HTML snippet. * @param valueAsString text that contains text and tags to be converted to a document fragment * @return a document fragment * @see <a href="https://developer.mozilla.org/en-US/docs/DOM/range.createContextualFragment">Mozilla * documentation</a> */ @JsxFunction public Object createContextualFragment(final String valueAsString) { final SgmlPage page = startContainer_.getDomNodeOrDie().getPage(); final DomDocumentFragment fragment = new DomDocumentFragment(page); try { HTMLParser.parseFragment(fragment, startContainer_.getDomNodeOrDie(), valueAsString); } catch (final Exception e) { LogFactory.getLog(Range.class).error("Unexpected exception occurred in createContextualFragment", e); throw Context.reportRuntimeError("Unexpected exception occurred in createContextualFragment: " + e.getMessage()); } return fragment.getScriptableObject(); }
node.setPrototype(getPrototype(node.getClass())); node.setDomNode(fragment); output_ = fragment.getScriptObject();
if (newChildNode instanceof DomDocumentFragment) { final DomDocumentFragment fragment = (DomDocumentFragment) newChildNode; for (final DomNode child : fragment.getChildren()) { jsxFunction_insertBefore(new Object[] {child.getScriptObject(), refChildObject}); && getWindow().getWebWindow().getWebClient().getBrowserVersion().isIE()) { final DomDocumentFragment fragment = domNode.getPage().createDomDocumentFragment(); fragment.appendChild(domNode);
/** * Appends a new child as the last child of the node. * @param newChild the new child node to be appended at the end of the list of children belonging to this node * @return the new child node successfully appended to the list */ @JsxFunction public Object appendChild(final Object newChild) { if (newChild == null || "null".equals(newChild)) { throw Context.reportRuntimeError("Type mismatch."); } Object appendedChild = null; if (newChild instanceof XMLDOMNode) { final XMLDOMNode childNode = (XMLDOMNode) newChild; // Get XML node for the DOM node passed in final DomNode childDomNode = childNode.getDomNodeOrDie(); // Get the parent XML node that the child should be added to. final DomNode parentNode = getDomNodeOrDie(); // Append the child to the parent node parentNode.appendChild(childDomNode); appendedChild = newChild; // if the parentNode has null parentNode in IE, // create a DocumentFragment to be the parentNode's parentNode. if (!(parentNode instanceof SgmlPage) && !(this instanceof XMLDOMDocumentFragment) && parentNode.getParentNode() == null) { final DomDocumentFragment fragment = parentNode.getPage().createDocumentFragment(); fragment.appendChild(parentNode); } } return appendedChild; }
/** * {@inheritDoc} */ @Override public String asXml() { final StringBuilder sb = new StringBuilder(); for (final DomNode node : getChildren()) { sb.append(node.asXml()); } return sb.toString(); }