File tree Expand file tree Collapse file tree
main/java/org/htmlunit/html
test/java/org/htmlunit/javascript/host/html Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,4 +83,13 @@ protected boolean isRequiredSupported() {
8383 public boolean willValidate () {
8484 return false ;
8585 }
86+
87+ /**
88+ * {@inheritDoc}
89+ */
90+ @ Override
91+ protected boolean isCustomValidityValid () {
92+ return true ;
93+ }
94+
8695}
Original file line number Diff line number Diff line change @@ -89,4 +89,12 @@ protected boolean isRequiredSupported() {
8989 public boolean willValidate () {
9090 return false ;
9191 }
92+
93+ /**
94+ * {@inheritDoc}
95+ */
96+ @ Override
97+ protected boolean isCustomValidityValid () {
98+ return true ;
99+ }
92100}
Original file line number Diff line number Diff line change 1414 */
1515package org .htmlunit .html ;
1616
17+ import static org .htmlunit .BrowserVersionFeatures .HTMLINPUT_TYPE_IMAGE_IGNORES_CUSTOM_VALIDITY ;
18+
1719import java .io .File ;
1820import java .io .IOException ;
1921import java .io .InputStream ;
@@ -191,7 +193,22 @@ public void setDefaultValue(final String defaultValue) {
191193 */
192194 @ Override
193195 public boolean willValidate () {
194- return false ;
196+ if (hasFeature (HTMLINPUT_TYPE_IMAGE_IGNORES_CUSTOM_VALIDITY )) {
197+ return false ;
198+ }
199+ return super .willValidate ();
200+ }
201+
202+ /**
203+ * {@inheritDoc}
204+ */
205+ @ Override
206+ protected boolean isCustomValidityValid () {
207+ if (hasFeature (HTMLINPUT_TYPE_IMAGE_IGNORES_CUSTOM_VALIDITY )) {
208+ return true ;
209+ }
210+
211+ return super .isCustomValidityValid ();
195212 }
196213
197214 /**
Original file line number Diff line number Diff line change 1414 */
1515package org .htmlunit .html ;
1616
17- import static org .htmlunit .BrowserVersionFeatures .HTMLINPUT_TYPE_IMAGE_IGNORES_CUSTOM_VALIDITY ;
1817import static org .htmlunit .BrowserVersionFeatures .HTMLINPUT_TYPE_MONTH_SUPPORTED ;
1918import static org .htmlunit .BrowserVersionFeatures .HTMLINPUT_TYPE_WEEK_SUPPORTED ;
2019import static org .htmlunit .html .HtmlForm .ATTRIBUTE_FORMNOVALIDATE ;
2120
2221import java .net .MalformedURLException ;
23- import java .util .Locale ;
2422import java .util .Map ;
2523
2624import org .apache .commons .logging .Log ;
@@ -865,16 +863,7 @@ && isMaxLengthValid() && isMinLengthValid()
865863 }
866864
867865 protected boolean isCustomValidityValid () {
868- if (isCustomErrorValidityState ()) {
869- final String type = getAttributeDirect (TYPE_ATTRIBUTE ).toLowerCase (Locale .ROOT );
870- if (!"button" .equals (type )
871- && !"hidden" .equals (type )
872- && !"reset" .equals (type )
873- && !("image" .equals (type ) && hasFeature (HTMLINPUT_TYPE_IMAGE_IGNORES_CUSTOM_VALIDITY ))) {
874- return false ;
875- }
876- }
877- return true ;
866+ return !isCustomErrorValidityState ();
878867 }
879868
880869 @ Override
Original file line number Diff line number Diff line change @@ -106,4 +106,12 @@ protected boolean isRequiredSupported() {
106106 public boolean willValidate () {
107107 return false ;
108108 }
109+
110+ /**
111+ * {@inheritDoc}
112+ */
113+ @ Override
114+ protected boolean isCustomValidityValid () {
115+ return true ;
116+ }
109117}
Original file line number Diff line number Diff line change @@ -3549,9 +3549,8 @@ public void clearCustomValidity_restoresValid() throws Exception {
35493549//
35503550// loadPageVerifyTitle2(html);
35513551// }
3552-
35533552 /**
3554- * reportValidity() is untested anywhere in this file -- basic coverage that
3553+ * The reportValidity() is untested anywhere in this file -- basic coverage that
35553554 * it returns the same boolean as checkValidity() for an input with a custom
35563555 * validity message set.
35573556 * @throws Exception if the test fails
Original file line number Diff line number Diff line change @@ -211,7 +211,7 @@ public void setCustomValidityDoesNotAffectCheckValidity() throws Exception {
211211
212212 loadPageVerifyTitle2 (html );
213213 }
214- //
214+
215215// /**
216216// * The validationMessage must always be empty on an <object>, even with a
217217// * custom validity message set and even when additionally barred via an
You can’t perform that action at this time.
0 commit comments