/** * {@inheritDoc} */ public DomText splitText(final int offset) { if (offset < 0 || offset > getLength()) { throw new IllegalArgumentException("offset: " + offset + " data.length: " + getLength()); } // split text into two separate nodes final DomText newText = createSplitTextNode(offset); setData(getData().substring(0, offset)); // insert new text node if (getParentNode() != null) { getParentNode().insertBefore(newText, getNextSibling()); } return newText; }
/** * {@inheritDoc} */ @Override public DomText splitText(final int offset) { if (offset < 0 || offset > getLength()) { throw new IllegalArgumentException("offset: " + offset + " data.length: " + getLength()); } // split text into two separate nodes final DomText newText = createSplitTextNode(offset); setData(getData().substring(0, offset)); // insert new text node if (getParentNode() != null) { getParentNode().insertBefore(newText, getNextSibling()); } return newText; }
/** * {@inheritDoc} */ public DomText splitText(final int offset) { if (offset < 0 || offset > getLength()) { throw new IllegalArgumentException("offset: " + offset + " data.length: " + getLength()); } // split text into two separate nodes final DomText newText = createSplitTextNode(offset); setData(getData().substring(0, offset)); // insert new text node if (getParentNode() != null) { getParentNode().insertBefore(newText, getNextSibling()); } return newText; }
/** * {@inheritDoc} */ public DomText splitText(final int offset) { if (offset < 0 || offset > getLength()) { throw new IllegalArgumentException("offset: " + offset + " data.length: " + getLength()); } // split text into two separate nodes final DomText newText = createSplitTextNode(offset); setData(getData().substring(0, offset)); // insert new text node if (getParentNode() != null) { getParentNode().insertBefore(newText, getNextSibling()); } return newText; }
/** * {@inheritDoc} */ @Override public DomText splitText(final int offset) { if (offset < 0 || offset > getLength()) { throw new IllegalArgumentException("offset: " + offset + " data.length: " + getLength()); } // split text into two separate nodes final DomText newText = createSplitTextNode(offset); setData(getData().substring(0, offset)); // insert new text node if (getParentNode() != null) { getParentNode().insertBefore(newText, getNextSibling()); } return newText; }
/** * Splits this text node into two text nodes at the specified offset and inserts the new text node into the tree * as a sibling that immediately follows this node. * @param offset the number of characters at which to split this text node into two nodes, starting from zero * @return the new text node */ @JsxFunction public Object splitText(final int offset) { if (offset < 0) { throw Context.reportRuntimeError("The offset must be 0 or a positive number that is not greater than the " + "number of characters in the data."); } final DomText domText = getDomNodeOrDie(); if (offset > domText.getLength()) { throw Context.reportRuntimeError("The offset must be 0 or a positive number that is not greater than the " + "number of characters in the data."); } return getScriptableFor(domText.splitText(offset)); }
/** * Splits this text node into two text nodes at the specified offset and inserts the new text node into the tree * as a sibling that immediately follows this node. * @param offset the number of characters at which to split this text node into two nodes, starting from zero * @return the new text node */ @JsxFunction public Object splitText(final int offset) { if (offset < 0) { throw Context.reportRuntimeError("The offset must be 0 or a positive number that is not greater than the " + "number of characters in the data."); } final DomText domText = getDomNodeOrDie(); if (offset > domText.getLength()) { throw Context.reportRuntimeError("The offset must be 0 or a positive number that is not greater than the " + "number of characters in the data."); } return getScriptableFor(domText.splitText(offset)); }