diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 97b267f821..b942b04842 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -11,6 +11,9 @@ Javadoc fixed for Document.elementFromPoint(). + + HTMLOptionsCollection.item() should return null if the provided index is not available. + CssRuleList.item() should return null if the provided index is not available. diff --git a/src/main/java/org/htmlunit/javascript/host/Element.java b/src/main/java/org/htmlunit/javascript/host/Element.java index 79d37e97e5..30e5d0f594 100644 --- a/src/main/java/org/htmlunit/javascript/host/Element.java +++ b/src/main/java/org/htmlunit/javascript/host/Element.java @@ -686,7 +686,7 @@ protected final boolean isDisplayNone() { * @see MSDN */ @JsxFunction - public Object insertAdjacentElement(final String where, final Object insertedElement) { + public Node insertAdjacentElement(final String where, final Object insertedElement) { if (insertedElement instanceof Node) { final Node insertedElementNode = (Node) insertedElement; final DomNode childNode = insertedElementNode.getDomNodeOrDie(); diff --git a/src/main/java/org/htmlunit/javascript/host/html/HTMLCanvasElement.java b/src/main/java/org/htmlunit/javascript/host/html/HTMLCanvasElement.java index cc4c4dbd5f..c9d33f930d 100644 --- a/src/main/java/org/htmlunit/javascript/host/html/HTMLCanvasElement.java +++ b/src/main/java/org/htmlunit/javascript/host/html/HTMLCanvasElement.java @@ -17,6 +17,7 @@ import static org.htmlunit.BrowserVersionFeatures.JS_CANVAS_DATA_URL_CHROME_PNG; import org.htmlunit.html.HtmlCanvas; +import org.htmlunit.javascript.HtmlUnitScriptable; import org.htmlunit.javascript.JavaScriptEngine; import org.htmlunit.javascript.configuration.JsxClass; import org.htmlunit.javascript.configuration.JsxConstructor; @@ -110,7 +111,7 @@ public void setHeight(final int height) { * or null if the given context ID is not supported */ @JsxFunction - public Object getContext(final String contextId) { + public HtmlUnitScriptable getContext(final String contextId) { if ("2d".equals(contextId)) { if (context2d_ == null) { final CanvasRenderingContext2D context = new CanvasRenderingContext2D(this); diff --git a/src/main/java/org/htmlunit/javascript/host/html/RowContainer.java b/src/main/java/org/htmlunit/javascript/host/html/RowContainer.java index a17ccde110..3564918abe 100644 --- a/src/main/java/org/htmlunit/javascript/host/html/RowContainer.java +++ b/src/main/java/org/htmlunit/javascript/host/html/RowContainer.java @@ -91,7 +91,7 @@ public void deleteRow(int rowIndex) { * @return the newly-created row */ @JsxFunction - public Object insertRow(final Object index) { + public HtmlUnitScriptable insertRow(final Object index) { int rowIndex = -1; if (!JavaScriptEngine.isUndefined(index)) { rowIndex = (int) JavaScriptEngine.toNumber(index); @@ -119,7 +119,7 @@ public Object insertRow(final Object index) { * @param index the index where the row should be inserted (0 <= index <= nbRows) * @return the inserted row */ - public Object insertRow(final int index) { + public HtmlUnitScriptable insertRow(final int index) { final HTMLCollection rows = getRows(); final int rowCount = rows.getLength(); final DomElement newRow = ((HtmlPage) getDomNodeOrDie().getPage()).createElement("tr");