Re: Styling <input type=text>

On Wed, Sep 30, 2015 at 7:06 AM, Anne van Kesteren <annevk@annevk.nl> wrote:
> For the user agent stylesheet, there's no good way to address <input
> type=text>, since there's many values that make the <input> element
> end up in the Text state.
>
> The only way seems to be something along the lines of
>
>   input:not([type=hidden i]):not([type=search i]):not([type=tel i])...
>
> which gets verbose (enough that I don't want to complete it) and is
> hard to maintain. Is this something we should try to tackle?
>
> See https://github.com/whatwg/html/pull/212 for context.

Personally, I think not.  A well-designed custom element with similar
functionality should either throw upon setting an unrecognized value,
silently ignore the set, or ignore what you're trying to set and
instead just set it to the default value.  <input> is a legacy mistake
with the worst possible behavior - accepting the set with any value,
but interpreting it as something else.  I'm okay with it being
annoying to deal with.

That said, if we did want to tackle it, the right way would be with an
:input-type() pseudoclass.  Then :input-type(text) would match
<input>, <input type=text>, and <input type=foo>.

~TJ

Received on Wednesday, 30 September 2015 17:57:18 UTC