[whatwg] Can the maximum allowed value length be changed to restrict the number of characters?
bzbarsky at MIT.EDU
Tue Aug 20 07:33:12 PDT 2013
On 8/19/13 7:40 PM, Ryosuke Niwa wrote:
> Also, http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#the-maxlength-attribute says "if the input element has a maximum allowed value length, then the code-unit length of the value of the element's value attribute must be equal to or less than the element's maximum allowed value length."
> This doesn't seem to match the behaviors of existing Web browsers
The spec bit you quote above is an _authoring_ conformance requirement.
That is <input maxlength="2" value="abc"> is not valid HTML and a
validator would flag it as invalid. What UAs do with this markup, on
the other hand, is defined by the UA conformance requirements, and what
they do is allow a value longer than maxlength if it's specified.
> or http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#maximum-allowed-value-length
These are the UA conformance requirements in question.
> The paragraph should be revised to mention and only mention that the maxlength attribute affects the validation and the user agents may prevent the user from typing more characters than the specified value.
The basic question is whether a validator should flag <input
maxlength="2" value="abc"> as a conformance error or not. It seems to
me like it should.
More information about the whatwg