RESOLVED WONTFIX 99115
Constraint Validation API tooLong property incorrect with prefilled value
https://bugs.webkit.org/show_bug.cgi?id=99115
Summary Constraint Validation API tooLong property incorrect with prefilled value
TJ VanToll
Reported 2012-10-11 16:30:49 PDT
Per the spec (http://www.whatwg.org/specs/web-apps/current-work/#constraint-validation-api) a form control's validity.tooLong property should be "true if the element's value is longer than the provided maximum length; false otherwise." However, if you have an input that has a preset value that is greater than its maxlength the tooLong property will still be false: <input id="foo" type="text" maxlength="1" value="AB"> <script> document.getElementById('foo').validity.tooLong; //false </script> Furthermore when this element is in a form that form is allowed to submit - http://jsfiddle.net/tj_vantoll/x5LEn/.
Attachments
Kent Tamura
Comment 1 2012-10-17 08:06:34 PDT
(In reply to comment #0) > Per the spec (http://www.whatwg.org/specs/web-apps/current-work/#constraint-validation-api) a form control's validity.tooLong property should be "true if the element's value is longer than the provided maximum length; false otherwise." Don't forget that green boxes are non-normative. We need to refer to other places for normative definition. See http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#limiting-user-input-length:-the-maxlength-attribute > Constraint validation: If an element has a maximum allowed value length, its dirty value flag is true, its value was last changed by a user edit (as opposed to a change made by a script), and the code-unit length of the element's value is greater than the element's maximum allowed value length, then the element is suffering from being too long. The input element is not dirty and not user-edited in this case.
Note You need to log in before you can comment on or make changes to this bug.