[whatwg] Text areas with pattern attributes?

Jonas Sicking jonas at sicking.cc
Sun Aug 30 19:42:19 PDT 2009


On Sat, Aug 29, 2009 at 10:44 PM, Ian Hickson<ian at hixie.ch> wrote:
> On Wed, 19 Aug 2009, Jonas Sicking wrote:
>> >
>> > What's the use-case for it? Textareas are almost always for such large
>> > amounts of input that they are almost always free-form text. Why allow
>> > the pattern attribute?
>>
>> A similar argument was made against putting the placeholder attribute on
>> <textarea>, until someone found a page where it was used.
>
> Indeed. The same argument is used for all features in HTML5.
>
>
>> I think in general it makes very little sense to say that <textarea>s
>> are different from <input type=text>. Technically the only difference is
>> that one is multiline and the other is not. So it seems like anything
>> that makes sense in <input type=text> makes sense in <textarea>.
>>
>> So for the pattern attribute, a use case would be on a site that accepts
>> US addresses (for example a store that only ships within the US), the
>> site could use a textarea together with a pattern that matches US
>> addresses.
>
> Show me the correct regular expression for that, then argue with a
> straight face that we should actually have that feature, and I'll add it. :-)

Ok, addresses might not be the best example. I would imagine that most
use cases for pattern for a single line, carries over if you want to
have that single line wrap and be displayed as multiple lines. So if
you can provide the list of use cases that was used to add pattern on
single-line input and I'd be very surprised if not most of them
carries over to multi-line.

The difference between <input type=text> and <textarea> is mostly a
rendering one. One scrolls the text when it can't fit, the other
wraps. Do you really think that creates enough of a difference that
the feature set should be different?

Of course, another solution would be to allow <input type=text> to
change rendering to be that of a textarea, and teach the world to
migrate from <textarea> to <input type=text>. That would seem more
semantically correct. However it would be a boiling-the-ocean type of
activity which I think we've generally stayed away from.

/ Jonas


More information about the whatwg mailing list