Skip to content

Commit

Permalink
more concrete return values
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Nov 10, 2024
1 parent 972f46c commit 89b9393
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<action type="fix" dev="rbri">
Javadoc fixed for Document.elementFromPoint().
</action>
<action type="fix" dev="rbri">
HTMLOptionsCollection.item() should return null if the provided index is not available.
</action>
<action type="fix" dev="rbri">
CssRuleList.item() should return null if the provided index is not available.
</action>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/htmlunit/javascript/host/Element.java
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ protected final boolean isDisplayNone() {
* @see <a href="http://msdn.microsoft.com/en-us/library/ie/ms536451.aspx">MSDN</a>
*/
@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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -119,7 +119,7 @@ public Object insertRow(final Object index) {
* @param index the index where the row should be inserted (0 &lt;= index &lt;= 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");
Expand Down

0 comments on commit 89b9393

Please sign in to comment.