[whatwg] Why [PutForwards=value] for htmlFor output element attribute ?
magnusrk+whatwg at pvv.org
Tue Apr 13 10:02:43 PDT 2010
On 08.04.2010 16:07, Olli Pettay wrote:
> On 4/5/10 3:21 PM, Mounir Lamouri wrote:
>> I'm wondering why the [PutForwards=value] extended attribute is needed
>> for the htmlFor output element attribute ?
>> It is making things pretty ugly for a need I do not really get.
> I agree. In general PutForwards makes APIs strange, IMO
> Location is a good example of a pretty awkward API.
> In the case of output element,
> element.htmlFor.value = "Something" isn't really
> more difficult than element.htmlFor = "something";
> Though, .htmlFor accept setting a string value in other
> interfacase, but in those cases the type of the attribute
> is DOMString.
> It is a bit ugly that one .htmlFor is DOMSettableTokenList,
> but other .htmlFors are DOMStrings
The PutForwards attribute mitigates this problem, by letting you treat
the property as if it were a DOMString if you want.
You could argue that every DOMSettableTokenList should have
PutForwards=value behavior by default, since it already forwards on getting.
> Would be at least great to know some good reasoning for
> using PutForwards.
> Btw why doesn't .classList have PutForwards
> (in which case it could use DOMSettableTokenList)
Direct access to the raw class attribute already exists as .className,
so there's no need.
"Don't worry; the Universe IS out to get you."
More information about the whatwg