/** * {@inheritDoc} */ @Override public Object appendChild(final Object childObject) { throw Context.reportRuntimeError("Node cannot be inserted at the specified point in the hierarchy."); }
/** * Overwritten to throw an exception. * @param value the new value for replacing this node */ @Override public void setOuterHTML(final Object value) { throw Context.reportRuntimeError("outerHTML is read-only for tag 'html'"); }
/** * Overwritten to throw an exception because this is readonly. * @param value the new value for the contents of this node */ @Override protected void setInnerTextImpl(final String value) { throw Context.reportRuntimeError("innerText is read-only for tag 'html'"); }
/** * Attempting to set the text of documents generates an error. * @param text the new text of this node */ @Override public void setText(final Object text) { if (text == null || "null".equals(text)) { throw Context.reportRuntimeError("Type mismatch."); } throw Context.reportRuntimeError("This operation cannot be performed with a node of type DOCUMENT."); }
/** * Attempting to set the value of elements generates an error. * @param newValue the new value to set */ @Override public void setNodeValue(final String newValue) { if (newValue == null || "null".equals(newValue)) { throw Context.reportRuntimeError("Type mismatch."); } throw Context.reportRuntimeError("This operation cannot be performed with a node of type ELEMENT."); }
/** * The number of nodes in the result snapshot. * @return the number of nodes in the result snapshot */ @JsxGetter public int getSnapshotLength() { if (resultType_ != UNORDERED_NODE_SNAPSHOT_TYPE && resultType_ != ORDERED_NODE_SNAPSHOT_TYPE) { throw Context.reportRuntimeError("Cannot get snapshotLength for type: " + resultType_); } return result_.size(); }
/** * Overwritten to throw an exception. * @param value the new value for replacing this node */ @JsxSetter @Override public void setOuterHTML(final Object value) { throw Context.reportRuntimeError("outerHTML is read-only for tag 'frameset'"); }
/** * Overwritten to throw an exception. * @param value the new value for replacing this node */ @JsxSetter @Override public void setOuterHTML(final Object value) { throw Context.reportRuntimeError("outerHTML is read-only for tag 'caption'"); } }
/** * {@inheritDoc} */ @Override public DomNode getDomNodeOrDie() { try { return super.getDomNodeOrDie(); } catch (final IllegalStateException e) { throw Context.reportRuntimeError("No node attached to this object"); } }
/** * {@inheritDoc} */ @Override protected Object insertBeforeImpl(final Object[] args) { final Object newChild = args[0]; verifyChild(newChild); if (args.length != 2) { throw Context.reportRuntimeError("Wrong number of arguments or invalid property assignment."); } return super.insertBeforeImpl(args); }
/** * {@inheritDoc} */ @Override public Object call(final Context cx, final Scriptable scope, final Scriptable thisObj, final Object[] args) { if (args.length == 0) { throw Context.reportRuntimeError("Zero arguments; need an index or a key."); } return nullIfNotFound(getIt(args[0])); }
/** * {@inheritDoc} */ @Override public Scriptable construct(final Context cx, final Scriptable scope, final Object[] args) { if (!getBrowserVersion().hasFeature(JS_FORM_USABLE_AS_FUNCTION)) { throw Context.reportRuntimeError("Not a function."); } return null; }
/** * Returns the value of this string result. * @return the value of this string result */ @JsxGetter public String getStringValue() { if (resultType_ != STRING_TYPE) { throw Context.reportRuntimeError("Cannot get stringValue for type: " + resultType_); } return asString(); }
/** * Sets the value of the {@code clear} property. * @param clear the value of the {@code clear} property */ @JsxSetter(IE) public void setClear(final String clear) { if (!ArrayUtils.contains(VALID_CLEAR_VALUES, clear)) { throw Context.reportRuntimeError("Invalid clear property value: '" + clear + "'."); } getDomNodeOrDie().setAttribute("clear", clear); } }
/** * Appends the supplied string to the existing string data. * @param data the data that is to be appended to the existing string */ @JsxFunction public void appendData(final String data) { if (data == null || "null".equals(data)) { throw Context.reportRuntimeError("Type mismatch."); } final DomCharacterData domCharacterData = getDomNodeOrDie(); domCharacterData.appendData(data); }
/** * Sets the value of the {@code clear} property. * @param clear the value of the {@code clear} property */ @JsxSetter(IE) public void setClear(final String clear) { if (!ArrayUtils.contains(VALID_CLEAR_VALUES, clear)) { throw Context.reportRuntimeError("Invalid clear property value: '" + clear + "'."); } getDomNodeOrDie().setAttribute("clear", clear); } }
@Override public Object call(final Context cx, final Scriptable scope, final Scriptable thisObj, final Object[] args) { if (getBrowserVersion().hasFeature(JS_DOCUMENT_FORMS_FUNCTION_SUPPORTED)) { return super.call(cx, scope, thisObj, args); } throw Context.reportRuntimeError("TypeError: document.images is not a function"); } };
@Override public Object call(final Context cx, final Scriptable scope, final Scriptable thisObj, final Object[] args) { if (getBrowserVersion().hasFeature(JS_DOCUMENT_FORMS_FUNCTION_SUPPORTED)) { return super.call(cx, scope, thisObj, args); } throw Context.reportRuntimeError("TypeError: document.scripts is not a function"); } };
/** * Sets the start of the range to be after the node. * @param refNode the reference node */ @JsxFunction public void setStartAfter(final Node refNode) { if (refNode == null) { throw Context.reportRuntimeError("It is illegal to call Range.setStartAfter() with a null node."); } startContainer_ = refNode.getParent(); startOffset_ = getPositionInContainer(refNode) + 1; }
/** * Sets the end of the range to be before the node. * @param refNode the reference node */ @JsxFunction public void setEndBefore(final Node refNode) { if (refNode == null) { throw Context.reportRuntimeError("It is illegal to call Range.setEndBefore() with a null node."); } startContainer_ = refNode.getParent(); startOffset_ = getPositionInContainer(refNode); }