[whatwg] IDL attribute reflecting enumerated attributes not limited to only know values

On 6/8/10 5:26 PM, Mounir Lamouri wrote:
> Hi,
>
> According to the HTML5 specification, an IDL attribute reflecting an
> enumerated attribute will have the default reflecting behavior (ie.
> return the content attribute on getting and setting it on setting)
> except if the attribute is "limited to only known values" [1]. There are
> three attributes limited to only known values in the current state of
> the specs: @dir, @shape (area element) and @keytype (keygen element).
>
> In other words, that means if @toto is an enumerated attribute with
> "foo" and "bar" states/keywords and "foo" as a default missing value, if
> @toto is set to "foobar", .toto will return "foobar". To have .toto
> returning "foo", the attribute has to be limited to only known value.
> Having .toto returning "foo" in this situation seems to be what we
> should expect because the content attribute is already accessible with
> @toto.
>
> An example where this behavior seems buggy:
> - input.type and button.type: every browser makes it return "text" if
> @type isn't set to a known value. If we follow the specifications, .type
> should return the current value of @type.
>
> Examples where having another behavior would help:
> - method, formmethod, enctype and formenctype have a list of
> keywords/states with a default missing value. It would be great to have
> the IDL attribute returning the current state instead of the content.
> So, scripts wouldn't have to look at the content, checking for values
> they know and falling-back to the default value to know the current state.
> - input.autocomplete: at the moment, it is returning the content but it
> could return the resulting autocompletion state which is maybe a bit
> more than just being limited to only known values but still in the same
> spirit.
>
> Maybe, instead of having some attributes "limited to only known values"
> we could have some attributes "not limited to only known values", thus
> inverting the default reflecting behavior for enumerated attriutes ?

Yeah, this sound ok to me. The current enumerate attribute handling
is weird and at least in some cases just buggy.


-Olli

>
> [1] http://dev.w3.org/html5/spec/Overview.html#limited-to-only-known-values
>
> Thanks,
> --
> Mounir
>

Received on Thursday, 10 June 2010 15:51:15 UTC