[whatwg] :enabled and :disabled pseudo-classes should apply on fieldset elements
Jonas Sicking
jonas at sicking.cc
Tue Dec 7 17:43:24 PST 2010
On Tue, Dec 7, 2010 at 5:08 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Sun, 12 Sep 2010, Mounir Lamouri wrote:
>>
>> The current state of the specifications do not mention fieldset elements
>> for the :enabled and :disabled pseudo-classes but fieldset can be
>> disabled so I guess it might be convenient to have these pseudo-classes
>> applied to them.
>>
>> Opera applies :disabled and :enabled to fieldset elements and Mozilla
>> might do the same.
>
> It's not really the <fieldset> that is enabled/disabled, it's the
> controls within it. Put it this way: if we dropped support for disabled=""
> from the spec, I think one would still argue that <input> is :enabled
Really? Why then isn't a <div> ever :enabled?
:enabled IMHO only makes sense on elements which can be disabled,
which is why div:enabled never matches anything. So if we removed
disabled="" from <input> I don't think input:enabled would match
anything.
>, but
> I don't think one would argue that <fieldset> is :enabled. Case in point,
> nobody argued that <fieldset> should match :enabled before we added the
> disabled="" attribute to it.
IMHO because it couldn't be disabled before then. Another question is,
on what basis are you saying that just the controls inside the
fieldset are disabled, and not also the fieldset itself?
I think a more important question is if it would be useful to have
fieldset:disabled match. I.e. would anyone want to use that selector
in CSS or querySelector? I have many times seen user interfaces like:
[X] Some preference
[ ] Sub-preference 1
[ ] Sub-preference 2
Where the sub-preferences are grayed out if the top-level preference
is. And it's generally not just the sub-pref checkboxes that are
grayed out, but also the labels next to them. This could be
accomplished using a selector like:
fieldset:disabled .controlLabel {
color: gray;
}
/ Jonas
More information about the whatwg
mailing list