/** * Returns a clone of the range in a document fragment. * @return a clone */ @JsxFunction public Object cloneContents() { return toW3C().cloneContents().getScriptableObject(); }
/** * Moves this range's contents from the document tree into a document fragment. * @return the new document fragment containing the range contents */ @JsxFunction public Object extractContents() { return toW3C().extractContents().getScriptableObject(); }
/** * Returns a clone of the range in a document fragment. * @return a clone */ @JsxFunction public Object cloneContents() { return toW3C().cloneContents().getScriptableObject(); }
/** * Moves this range's contents from the document tree into a document fragment. * @return the new document fragment containing the range contents */ @JsxFunction public Object extractContents() { return toW3C().extractContents().getScriptableObject(); }
/** * 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(); }
/** * 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.getScriptableObject();
node.setPrototype(getPrototype(node.getClass())); node.setDomNode(fragment); output_ = fragment.getScriptableObject();