[css3-ui] :text-input pseudoclass

View: New views
4 Messages — Rating Filter:   Alert me  

[css3-ui] :text-input pseudoclass

by Tab Atkins Jr. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I would like to see a :text-input pseudoclass in CSS3 UI.  It would
match against any input which is a text input.  In HTML, this means
<input type=text>, <input> (no type), and <input type=unknown>.

This is necessary because there are an infinite number of possible
values for type that would produce a text input.  Right now the only
way to safely match all text inputs is to do
input:not([type=password]):not([type=submit]):not([type=date])...

I commonly use inputs without a type, while generated content
(produced by script plugins, for example) usually includes type=text,
and I want to style these the same easily.  As well, I'd like
currently unsupported input types (like date in anything but Opera) to
be styled like text inputs while they're unsupported, but be styled
like proper date inputs later when they're recognized as such.

~TJ


Re: [css3-ui] :text-input pseudoclass

by Nikita Popov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tab Atkins Jr. schrieb:

> I would like to see a :text-input pseudoclass in CSS3 UI.  It would
> match against any input which is a text input.  In HTML, this means
> <input type=text>, <input> (no type), and <input type=unknown>.
>
> This is necessary because there are an infinite number of possible
> values for type that would produce a text input.  Right now the only
> way to safely match all text inputs is to do
> input:not([type=password]):not([type=submit]):not([type=date])...
>
> I commonly use inputs without a type, while generated content
> (produced by script plugins, for example) usually includes type=text,
> and I want to style these the same easily.  As well, I'd like
> currently unsupported input types (like date in anything but Opera) to
> be styled like text inputs while they're unsupported, but be styled
> like proper date inputs later when they're recognized as such.
>
> ~TJ
Why not to  use input:not([type]), input[type=text]?

Nikita Popov



Re: [css3-ui] :text-input pseudoclass

by Boris Zbarsky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 11/3/09 4:36 PM, Nikita Popov wrote:
> Why not to use input:not([type]), input[type=text]?

Because that doesn't match these text inputs:

<input type="">
<input type="notsomethinginthespec">
<input type=" text ">

-Boris


Re: [css3-ui] :text-input pseudoclass

by Tab Atkins Jr. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 3, 2009 at 1:36 PM, Nikita Popov <privat@...> wrote:
> Why not to  use input:not([type]), input[type=text]?

Because it's more complex than that.  I also have to target the inputs
that use an unrecognized type, like type=date in most current
browsers.  I can't naively do input[type=date], because if the browser
*does* support type=date I very likely want to style it differently.
As well, if more new input types appear, I'll have to update the
styles anywhere I use it.  Finally, if I want to do anything more than
a simple input selector, it'll become massively complicated and
unwieldy and introduce the strong possibility of typo bugs.

So, yeah, it's a difficult issue.

~TJ