Skip to content

Commit fd9ef93

Browse files
committed
Method reportValidity() support to various form controls added
Various HtmlButton validation processing related fixed
1 parent db0800d commit fd9ef93

13 files changed

Lines changed: 489 additions & 67 deletions

src/changes/changes.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
<body>
1010
<release version="5.4.0" date="August xx, 2026" description="Firefox 153, Bugfixes">
11+
<action type="add" dev="rbri">
12+
Method reportValidity() support to various form controls added.
13+
</action>
14+
<action type="fix" dev="rbri">
15+
Various HtmlButton validation processing related fixed.
16+
</action>
1117
<action type="remove" dev="rbri">
1218
Document HtmlButton's no-op implementations for reset and default value handling, and remove extraneous debug logging.
1319
</action>

src/main/java/org/htmlunit/html/HtmlButton.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ protected boolean isEmptyXmlTagExpanded() {
316316
*/
317317
@Override
318318
public boolean isValid() {
319-
if (TYPE_RESET.equals(getType())) {
319+
if (TYPE_RESET.equals(getType()) || TYPE_BUTTON.equals(getType())) {
320320
return true;
321321
}
322322

src/main/java/org/htmlunit/javascript/host/html/HTMLButtonElement.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,15 @@ public boolean checkValidity() {
153153
return getDomNodeOrDie().isValid();
154154
}
155155

156+
/**
157+
* Performs the same validity checking steps as the checkValidity() method.
158+
* @return {@code true} if the element is valid
159+
*/
160+
@JsxFunction
161+
public boolean reportValidity() {
162+
return checkValidity();
163+
}
164+
156165
/**
157166
* Returns a {@link ValidityState} object representing the validity states of this element.
158167
* @return a {@link ValidityState} object representing the validity states of this element

src/main/java/org/htmlunit/javascript/host/html/HTMLFieldSetElement.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ public boolean checkValidity() {
8787
return getDomNodeOrDie().isValid();
8888
}
8989

90+
/**
91+
* Performs the same validity checking steps as the checkValidity() method.
92+
* @return {@code true} if the element is valid
93+
*/
94+
@JsxFunction
95+
public boolean reportValidity() {
96+
return checkValidity();
97+
}
98+
9099
/**
91100
* {@inheritDoc} Overridden to modify browser configurations.
92101
*/

src/main/java/org/htmlunit/javascript/host/html/HTMLFormElement.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,15 @@ public boolean checkValidity() {
554554
return getDomNodeOrDie().isValid();
555555
}
556556

557+
/**
558+
* Performs the same validity checking steps as the checkValidity() method.
559+
* @return {@code true} if the element is valid
560+
*/
561+
@JsxFunction
562+
public boolean reportValidity() {
563+
return checkValidity();
564+
}
565+
557566
/**
558567
* Returns the value of the property {@code novalidate}.
559568
* @return the value of this property

src/main/java/org/htmlunit/javascript/host/html/HTMLInputElement.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,15 @@ public boolean checkValidity() {
735735
return getDomNodeOrDie().isValid();
736736
}
737737

738+
/**
739+
* Performs the same validity checking steps as the checkValidity() method.
740+
* @return {@code true} if the element is valid
741+
*/
742+
@JsxFunction
743+
public boolean reportValidity() {
744+
return checkValidity();
745+
}
746+
738747
/**
739748
* {@inheritDoc}
740749
*/

src/main/java/org/htmlunit/javascript/host/html/HTMLObjectElement.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,15 @@ public boolean checkValidity() {
176176
return getDomNodeOrDie().isValid();
177177
}
178178

179+
/**
180+
* Performs the same validity checking steps as the checkValidity() method.
181+
* @return {@code true} if the element is valid
182+
*/
183+
@JsxFunction
184+
public boolean reportValidity() {
185+
return checkValidity();
186+
}
187+
179188
/**
180189
* Returns a {@link ValidityState} object representing the validity states of this element.
181190
* @return a {@link ValidityState} object representing the validity states of this element

src/main/java/org/htmlunit/javascript/host/html/HTMLOutputElement.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ public boolean checkValidity() {
103103
return getDomNodeOrDie().isValid();
104104
}
105105

106+
/**
107+
* Performs the same validity checking steps as the checkValidity() method.
108+
* @return {@code true} if the element is valid
109+
*/
110+
@JsxFunction
111+
public boolean reportValidity() {
112+
return checkValidity();
113+
}
114+
106115
/**
107116
* Returns a {@link ValidityState} object representing the validity states of this element.
108117
* @return a {@link ValidityState} object representing the validity states of this element

src/main/java/org/htmlunit/javascript/host/html/HTMLSelectElement.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,15 @@ public boolean checkValidity() {
403403
return getDomNodeOrDie().isValid();
404404
}
405405

406+
/**
407+
* Performs the same validity checking steps as the checkValidity() method.
408+
* @return {@code true} if the element is valid
409+
*/
410+
@JsxFunction
411+
public boolean reportValidity() {
412+
return checkValidity();
413+
}
414+
406415
/**
407416
* Returns a {@link ValidityState} object representing the validity states of this element.
408417
* @return a {@link ValidityState} object representing the validity states of this element

src/main/java/org/htmlunit/javascript/host/html/HTMLTextAreaElement.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,15 @@ public boolean checkValidity() {
377377
return getDomNodeOrDie().isValid();
378378
}
379379

380+
/**
381+
* Performs the same validity checking steps as the checkValidity() method.
382+
* @return {@code true} if the element is valid
383+
*/
384+
@JsxFunction
385+
public boolean reportValidity() {
386+
return checkValidity();
387+
}
388+
380389
/**
381390
* Returns the {@code required} property.
382391
* @return the {@code required} property

0 commit comments

Comments
 (0)