[whatwg] Form controls disabled IDL attribute and disabled state

Hi,

With HTML4 (at least before fieldset.disabled), form controls disabled
IDL attribute was a simple way to set and get the disabled state because
the disabled state and the disabled content attribute were exactly the
same thing.

Now, with fieldset.disabled, disabled IDL attribute has no longer the
same meaning. It's now only reflecting the content attribute and not the
disabled state. Nothing in the API let the author knows the disabled
state so the only solution is to look at the entire parent chain until a
fieldset with the disabled attribute is found [1].

I can understand why when getting the disabled IDL attribute, this is
not returning the state but the content attribute but I think there is a
lack in the API and it might be nice for authors to have a simple way to
know the state of the element [2]. This could be done with the IDL
attribute returning the state instead of the content attribute or
another attribute returning the state.

Feedbacks welcome :)

[1] if the fieldset has no disabled attribute, it still might be a child
of another fieldset which has a disabled attribute.

[2] some tricks might be to use query selector and check if the element
has the :disabled pseudo-class applying but that's only a workaround.

--
Mounir

Received on Saturday, 11 September 2010 15:57:52 UTC